new-envwith_gc
Last change
on this file since 5af7306 was
b7170a64,
checked in by Thierry Delisle <tdelisle@…>, 7 years ago
|
Updated the creation and ctxswitch benchmark to all be consistent and flexible
|
-
Property mode set to
100644
|
File size:
374 bytes
|
Line | |
---|
1 | #include <stdio.h> |
---|
2 | #include <thread> |
---|
3 | |
---|
4 | #include "bench.h" |
---|
5 | |
---|
6 | coroutine GreatSuspender {}; |
---|
7 | |
---|
8 | void ?{}( GreatSuspender & this ) { |
---|
9 | prime(this); |
---|
10 | } |
---|
11 | |
---|
12 | void main( GreatSuspender & this ) { |
---|
13 | while( true ) { |
---|
14 | suspend(); |
---|
15 | } |
---|
16 | } |
---|
17 | |
---|
18 | int main(int argc, char* argv[]) { |
---|
19 | GreatSuspender s; |
---|
20 | |
---|
21 | BENCH( |
---|
22 | for (size_t i = 0; i < n; i++) { |
---|
23 | resume( s ); |
---|
24 | }, |
---|
25 | result |
---|
26 | ) |
---|
27 | |
---|
28 | printf("%llu\n", result); |
---|
29 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.