source: benchmark/ctxswitch/qthreads.c@ 03bf5c8

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation new-ast new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since 03bf5c8 was fe065c3, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

new CFA generator and qthreads tests

  • Property mode set to 100644
File size: 953 bytes
Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <assert.h>
4#include <unistd.h>
5#include <qthread.h>
6
7#include "bench.h"
8
9int argc;
10char **argv;
11
12static aligned_t greeter( __attribute__((unused)) void * arg ) {
13 BENCH(
14 for ( size_t i = 0; i < n; i += 1 ) {
15 qthread_yield();
16 },
17 result
18 )
19 printf( "%g\n", result );
20 return 0;
21}
22
23int main( int margc, char *margv[] ) {
24 argc = margc;
25 argv = margv;
26
27 aligned_t return_value = 0;
28 int status;
29
30 status = qthread_init( 1 );
31 assert(status == QTHREAD_SUCCESS);
32
33 status = qthread_fork( greeter, NULL, &return_value );
34 assert(status == QTHREAD_SUCCESS);
35
36 int ret = qthread_readFF( NULL, &return_value );
37 assert(ret == QTHREAD_SUCCESS);
38
39 return EXIT_SUCCESS;
40}
41
42// Local Variables: //
43// tab-width: 4 //
44// compile-command: "gcc -g -O2 -Wall -I.. -I/u/pabuhr/software/qthreads/include -L/u/pabuhr/software/qthreads/lib -Xlinker -R/u/pabuhr/software/qthreads/lib qthreads.c -lqthread" //
45// End: //
Note: See TracBrowser for help on using the repository browser.