Mercurial > hg > Members > innparusu > Gears
view src/parallel_execution/time.c @ 95:3e28ee215c0e
modify twice, use OSAtomiceCompareAndSwap
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 29 Jan 2016 05:36:52 +0900 |
parents | |
children | 64c98838a291 |
line wrap: on
line source
#include <stdio.h> #include <sys/time.h> #include "context.h" #include "origin_cs.h" __code start_time(struct Context* context, struct Time* time) { struct timeval tv; gettimeofday(&tv, NULL); time->time = tv.tv_sec + (double)tv.tv_usec*1e-6; stack_pop(context->code_stack, &context->next); goto meta(context, context->next); } __code start_time_stub(struct Context* context) { goto start_time(context, &context->data[Time]->time); } __code end_time(struct Context* context, struct Time* time) { struct timeval tv; gettimeofday(&tv, NULL); printf("%0.6f\n", (tv.tv_sec+(double)tv.tv_usec*1e-6) - time->time); stack_pop(context->code_stack, &context->next); goto meta(context, context->next); } __code end_time_stub(struct Context* context) { goto end_time(context, &context->data[Time]->time); }