-
Notifications
You must be signed in to change notification settings - Fork 0
/
minitest1.cpp
397 lines (369 loc) · 7.33 KB
/
minitest1.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
#include <bits/stdc++.h>
using namespace std;
#include "executor.hpp"
#include <unistd.h>
#define Sleep(X) usleep(X * 1000)
#include <chrono>
using namespace std::chrono;
void fun1(){
cout<<"Function 1 start!\n";
sleep(1);
cout<<"Function 1 finish!\n";
}
void fun2(){
cout<<"Function 2 start!\n";
sleep(1);
cout<<"Function 2 finish!\n";
}
void fun3(){
cout<<"Function 3 start!\n";
sleep(1);
cout<<"Function 3 finish!\n";
}
void fun4(){
cout<<"Function 4 start!\n";
sleep(1);
cout<<"Function 4 finish!\n";
}
void fun5(){
cout<<"Function 5 start!\n";
sleep(1);
cout<<"Function 5 finish!\n";
}
void fun6(){
cout<<"Function 6 start!\n";
sleep(1);
cout<<"Function 6 finish!\n";
}
void fun7(){
cout<<"Function 7 start!\n";
sleep(1);
cout<<"Function 7 finish!\n";
}
void fun8(){
cout<<"Function 8 start!\n";
sleep(1);
cout<<"Function 8 finish!\n";
}
void fun9(){
cout<<"Function 9 start!\n";
sleep(1);
cout<<"Function 9 finish!\n";
}
void fun10(){
cout<<"Function 10 start!\n";
sleep(1);
cout<<"Function 10 finish!\n";
}
void fun11(){
cout<<"Function 11 start!\n";
sleep(1);
cout<<"Function 11 finish!\n";
}
void fun12(){
cout<<"Function 12 start!\n";
sleep(1);
cout<<"Function 12 finish!\n";
}
void fun13(){
cout<<"Function 13 start!\n";
sleep(1);
cout<<"Function 13 finish!\n";
}
void fun14(){
cout<<"Function 14 start!\n";
sleep(1);
cout<<"Function 14 finish!\n";
}
void fun15(){
cout<<"Function 15 start!\n";
sleep(1);
cout<<"Function 15 finish!\n";
}
void fun16(){
cout<<"Function 16 start!\n";
sleep(1);
cout<<"Function 16 finish!\n";
}
void fun17(){
cout<<"Function 17 start!\n";
sleep(1);
cout<<"Function 17 finish!\n";
}
void fun18(){
cout<<"Function 18 start!\n";
sleep(1);
cout<<"Function 18 finish!\n";
}
void fun19(){
cout<<"Function 19 start!\n";
sleep(1);
cout<<"Function 19 finish!\n";
}
void fun20(){
cout<<"Function 20 start!\n";
sleep(1);
cout<<"Function 20 finish!\n";
}
void fun21(){
cout<<"Function 21 start!\n";
sleep(1);
cout<<"Function 21 finish!\n";
}
void fun22(){
cout<<"Function 22 start!\n";
sleep(1);
cout<<"Function 22 finish!\n";
}
void fun23(){
cout<<"Function 23 start!\n";
sleep(1);
cout<<"Function 23 finish!\n";
}
void fun24(){
cout<<"Function 24 start!\n";
sleep(1);
cout<<"Function 24 finish!\n";
}
void fun25(){
cout<<"Function 25 start!\n";
sleep(1);
cout<<"Function 25 finish!\n";
}
void fun26(){
cout<<"Function 26 start!\n";
sleep(1);
cout<<"Function 26 finish!\n";
}
void fun27(){
cout<<"Function 27 start!\n";
sleep(1);
cout<<"Function 27 finish!\n";
}
void fun28(){
cout<<"Function 28 start!\n";
sleep(1);
cout<<"Function 28 finish!\n";
}
void fun29(){
cout<<"Function 29 start!\n";
sleep(1);
cout<<"Function 29 finish!\n";
}
void fun30(){
cout<<"Function 30 start!\n";
sleep(1);
cout<<"Function 30 finish!\n";
}
void fun31(){
cout<<"Function 31 start!\n";
sleep(1);
cout<<"Function 31 finish!\n";
}
void fun32(){
cout<<"Function 32 start!\n";
sleep(1);
cout<<"Function 32 finish!\n";
}
void fun33(){
cout<<"Function 33 start!\n";
sleep(1);
cout<<"Function 33 finish!\n";
}
void fun34(){
cout<<"Function 34 start!\n";
sleep(1);
cout<<"Function 34 finish!\n";
}
void fun35(){
cout<<"Function 35 start!\n";
sleep(1);
cout<<"Function 35 finish!\n";
}
void fun36(){
cout<<"Function 36 start!\n";
sleep(1);
cout<<"Function 36 finish!\n";
}
void fun37(){
cout<<"Function 37 start!\n";
sleep(1);
cout<<"Function 37 finish!\n";
}
void fun38(){
cout<<"Function 38 start!\n";
sleep(1);
cout<<"Function 38 finish!\n";
}
void fun39(){
cout<<"Function 39 start!\n";
sleep(1);
cout<<"Function 39 finish!\n";
}
void fun40(){
cout<<"Function 40 start!\n";
sleep(1);
cout<<"Function 40 finish!\n";
}
void fun41(){
cout<<"Function 41 start!\n";
sleep(1);
cout<<"Function 41 finish!\n";
}
void fun42(){
cout<<"Function 42 start!\n";
sleep(1);
cout<<"Function 42 finish!\n";
}
void fun43(){
cout<<"Function 43 start!\n";
sleep(1);
cout<<"Function 43 finish!\n";
}
void fun44(){
cout<<"Function 44 start!\n";
sleep(1);
cout<<"Function 44 finish!\n";
}
void fun45(){
cout<<"Function 45 start!\n";
sleep(1);
cout<<"Function 45 finish!\n";
}
void fun46(){
cout<<"Function 46 start!\n";
sleep(1);
cout<<"Function 46 finish!\n";
}
void fun47(){
cout<<"Function 47 start!\n";
sleep(1);
cout<<"Function 47 finish!\n";
}
void fun48(){
cout<<"Function 48 start!\n";
sleep(1);
cout<<"Function 48 finish!\n";
}
void fun49(){
cout<<"Function 49 start!\n";
sleep(1);
cout<<"Function 49 finish!\n";
}
int main(){
auto start = high_resolution_clock::now();
Taskflow myflow = Taskflow("myflow");
auto A = myflow.add({
fun1,
fun2,
fun3,
fun4,
fun5,
fun6,
fun7,
fun8,
fun9,
fun10,
fun11,
fun12,
fun13,
fun14,
fun15,
fun16,
fun17,
fun18,
fun19,
fun20,
fun21,
fun22,
fun23,
fun24,
fun25,
fun26,
fun27,
fun28,
fun29,
fun30,
fun31,
fun32,
fun33,
fun34,
fun35,
fun36,
fun37,
fun38,
fun39,
fun40,
fun41,
fun42,
fun43,
fun44,
fun45,
fun46,
fun47,
fun48,
});
// A[1]->precede({A[0]});
// A[2]->precede({A[1]});
// A[3]->precede({A[2]});
// A[4]->precede({A[3]});
// A[5]->precede({A[4]});
// A[6]->precede({A[5]});
// A[7]->precede({A[6]});
// A[8]->precede({A[7]});
// A[9]->precede({A[8]});
// A[10]->precede({A[9]});
// A[11]->precede({A[10]});
// A[12]->precede({A[11]});
// A[13]->precede({A[12]});
// A[14]->precede({A[13]});
// A[15]->precede({A[14]});
// A[17]->precede({A[16]});
// A[18]->precede({A[17]});
// A[19]->precede({A[18]});
// A[20]->precede({A[19]});
// A[21]->precede({A[20]});
// A[22]->precede({A[21]});
// A[23]->precede({A[22]});
// A[24]->precede({A[23]});
// A[25]->precede({A[24]});
// A[26]->precede({A[25]});
// A[27]->precede({A[26]});
// A[28]->precede({A[27]});
// A[29]->precede({A[28]});
// A[30]->precede({A[29]});
// A[31]->precede({A[30]});
// A[33]->precede({A[32]});
// A[34]->precede({A[33]});
// A[35]->precede({A[34]});
// A[36]->precede({A[35]});
// A[37]->precede({A[36]});
// A[38]->precede({A[37]});
// A[39]->precede({A[38]});
// A[40]->precede({A[39]});
// A[41]->precede({A[40]});
// A[42]->precede({A[41]});
// A[43]->precede({A[42]});
// A[44]->precede({A[43]});
// A[45]->precede({A[44]});
// A[46]->precede({A[45]});
// A[47]->precede({A[46]});
// A[48]->precede({A[47]});
// A[3]->precede({A[2], A[0]});
// for(auto test: myflow.taskflow[0]->successor){
// test->execute_task();
// }
// A[1].execute_task();
Executor exe;
exe.run(myflow);
cout<<"run mc";
auto stop = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stop - start);
cout <<"Total time taken for mini-taskflow:"<< duration.count()/1e6 << endl;
return 0;
// vector<Task> your = myflow.taskflow[0]->successor;
//Serial execution
// for(auto task: exe.topological_sort_list){
// task->execute_task();
// }
}