source:
benchmark/ctxswitch/kos_fibre2.cpp
@
bc4a433
Last change on this file since bc4a433 was b4107c8, checked in by , 5 years ago | |
---|---|
|
|
File size: 445 bytes |
Rev | Line | |
---|---|---|
[6810fcb] | 1 | #include <libfibre/fibre.h> |
2 | ||
3 | #include "bench.h" | |
4 | ||
5 | volatile bool done = false; | |
6 | ||
7 | static void f1main() { | |
8 | while(!done) { | |
9 | Fibre::yield(); | |
10 | } | |
11 | } | |
12 | ||
[b4107c8] | 13 | int main( int argc, char * argv[] ) { |
14 | BENCH_START() | |
[6810fcb] | 15 | Fibre* f1 = (new Fibre)->run(f1main); |
16 | BENCH( | |
[b4107c8] | 17 | for (size_t i = 0; i < times; i++) { |
[6810fcb] | 18 | Fibre::yield(); |
19 | }, | |
20 | result | |
21 | ) | |
[b4107c8] | 22 | printf( "%g\n", result ); |
[6810fcb] | 23 | done = true; |
24 | Fibre::yield(); | |
25 | f1->join(); | |
[dc33b5b] | 26 | } |
[b4107c8] | 27 | |
28 | // Local Variables: // | |
29 | // tab-width: 4 // | |
30 | // End: // |
Note: See TracBrowser
for help on using the repository browser.