source: benchmark/ctxswitch/upp_cor.cc @ dc33b5b

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since dc33b5b was dc33b5b, checked in by Peter A. Buhr <pabuhr@…>, 5 years ago

update benchmarks and add benchmarks for qthreads

  • Property mode set to 100644
File size: 374 bytes
Line 
1#include <cstdio>
2
3#include "bench.h"
4
5_Coroutine GreatSuspender {
6public:
7        GreatSuspender() {
8                resume();
9        }
10
11        void do_resume() {
12                resume();
13        }
14private:
15        void main() {
16                while( true ) {
17                        suspend();
18                }
19        }
20};
21
22int main(int argc, char* argv[]) {
23        GreatSuspender s;
24
25        BENCH(
26                for (size_t i = 0; i < n; i++) {
27                        s.do_resume();
28                },
29                result
30        )
31
32        printf("%g\n", result);
33}
Note: See TracBrowser for help on using the repository browser.