source: benchmark/schedint/cfa1.cfa @ dc33b5b

arm-ehjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-expr
Last change on this file since dc33b5b was dc33b5b, checked in by Peter A. Buhr <pabuhr@…>, 2 years ago

update benchmarks and add benchmarks for qthreads

  • Property mode set to 100644
File size: 651 bytes
Line 
1#include <kernel.hfa>
2#include <monitor.hfa>
3#include <thread.hfa>
4#include <stdio.h>
5
6#include "bench.h"
7
8int argc;
9char** argv;
10volatile int go = 0;
11
12condition c;
13monitor M {};
14M m1;
15
16void __attribute__((noinline)) call( M & mutex a1 ) {
17        signal(c);
18}
19
20int  __attribute__((noinline)) wait( M & mutex a1 ) {
21        go = 1;
22        BENCH(
23                for ( i; n ) {
24                        wait(c);
25                },
26                result
27        )
28
29        printf("%g\n", result);
30        go = 0;
31        return 0;
32}
33
34thread T {};
35void ^?{}( T & mutex ) {}
36void main( T & ) {
37        while(go == 0) { yield(); }
38        while(go == 1) { call(m1); }
39
40}
41
42int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) {
43        T t;
44        return wait(m1);
45}
Note: See TracBrowser for help on using the repository browser.