Mercurial > hg > Members > innparusu > Gears
comparison 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 |
comparison
equal
deleted
inserted
replaced
92:851da1107223 | 95:3e28ee215c0e |
---|---|
1 #include <stdio.h> | |
2 #include <sys/time.h> | |
3 | |
4 #include "context.h" | |
5 #include "origin_cs.h" | |
6 | |
7 __code start_time(struct Context* context, struct Time* time) { | |
8 struct timeval tv; | |
9 gettimeofday(&tv, NULL); | |
10 | |
11 time->time = tv.tv_sec + (double)tv.tv_usec*1e-6; | |
12 | |
13 stack_pop(context->code_stack, &context->next); | |
14 goto meta(context, context->next); | |
15 } | |
16 | |
17 __code start_time_stub(struct Context* context) { | |
18 goto start_time(context, &context->data[Time]->time); | |
19 } | |
20 | |
21 __code end_time(struct Context* context, struct Time* time) { | |
22 struct timeval tv; | |
23 gettimeofday(&tv, NULL); | |
24 | |
25 printf("%0.6f\n", (tv.tv_sec+(double)tv.tv_usec*1e-6) - time->time); | |
26 | |
27 stack_pop(context->code_stack, &context->next); | |
28 goto meta(context, context->next); | |
29 } | |
30 | |
31 __code end_time_stub(struct Context* context) { | |
32 goto end_time(context, &context->data[Time]->time); | |
33 } |