annotate src/parallel_execution/TimeImpl.cbc @ 447:57132ef16009

Remove ALLOCATE_DATA_GEAR from par goto code gear arguments
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Thu, 30 Nov 2017 15:42:19 +0900
parents f1d111e293c4
children 8d7e5d48cad3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
95
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include <stdio.h>
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include <sys/time.h>
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
278
23767f714f4a fix generate_stub
mir3636
parents: 277
diff changeset
4 #include "../context.h"
95
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
364
a0a3301bac4d Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 278
diff changeset
6 Time* createTimeImpl(struct Context* context) {
447
57132ef16009 Remove ALLOCATE_DATA_GEAR from par goto code gear arguments
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 382
diff changeset
7 struct Time* time = new Time();
364
a0a3301bac4d Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 278
diff changeset
8 struct TimeImpl* timeImpl = new TimeImpl();
a0a3301bac4d Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 278
diff changeset
9 time->time = (union Data*)timeImpl;
a0a3301bac4d Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 278
diff changeset
10 time->start = C_startTime;
a0a3301bac4d Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 278
diff changeset
11 time->end = C_endTime;
a0a3301bac4d Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 278
diff changeset
12 return time;
a0a3301bac4d Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 278
diff changeset
13 }
a0a3301bac4d Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 278
diff changeset
14
a0a3301bac4d Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 278
diff changeset
15 __code startTime(struct TimeImpl* time, __code next(...)) {
95
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 struct timeval tv;
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 gettimeofday(&tv, NULL);
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 time->time = tv.tv_sec + (double)tv.tv_usec*1e-6;
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
364
a0a3301bac4d Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 278
diff changeset
21 goto next(...);
95
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 }
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23
364
a0a3301bac4d Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 278
diff changeset
24 __code endTime(struct TimeImpl* time, __code next(...)) {
95
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 struct timeval tv;
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 gettimeofday(&tv, NULL);
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 printf("%0.6f\n", (tv.tv_sec+(double)tv.tv_usec*1e-6) - time->time);
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29
364
a0a3301bac4d Add Time interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 278
diff changeset
30 goto next(...);
95
3e28ee215c0e modify twice, use OSAtomiceCompareAndSwap
Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 }