source: benchmark/ctxswitch/kos_fibre2.cpp @ 83b2fb5e

Last change on this file since 83b2fb5e was b4107c8, checked in by Peter A. Buhr <pabuhr@…>, 5 years ago

update existing benchmarks for changes to bench.h, add new benchmarks in new programming languages

  • Property mode set to 100644
File size: 445 bytes
RevLine 
[6810fcb]1#include <libfibre/fibre.h>
2
3#include "bench.h"
4
5volatile bool done = false;
6
7static void f1main() {
8        while(!done) {
9                Fibre::yield();
10        }
11}
12
[b4107c8]13int 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.