source: doc/theses/colby_parsons_MMath/benchmarks/mutex_stmt/cfa/order.cfa

Last change on this file was f945fa7, checked in by Peter A. Buhr <pabuhr@…>, 12 hours ago

fix spelling mistake in directory name

  • Property mode set to 100644
File size: 868 bytes
Line 
1#include <locks.hfa>
2#include <mutex_stmt.hfa>
3#include <stdio.h>
4
5#include "../bench.h"
6
7test_spinlock LOCKS;
8
9bool done = false;
10uint64_t total = 0;
11thread worker {};
12static inline void ?{}( worker & this, cluster & clu ) {
13 ((thread &)this){ clu };
14}
15void main( worker & w ) {
16 BENCH( mutex ( LOCKS ) { }, total, done )
17}
18
19int main( int argc, char * argv[] ) {
20 BENCH_START()
21 cluster clus;
22 processor * proc[threads];
23 for ( i; threads ) // create procs
24 (*(proc[i] = alloc())){clus};
25
26 worker * w[threads];
27 for ( i; threads ) // create threads
28 (*(w[i] = alloc())){ clus };
29
30 sleep( 10`s );
31 done = true;
32
33 for ( i; threads ) // delete threads
34 delete(w[i]);
35
36 for ( i; threads ) // delete procs
37 delete(proc[i]);
38 printf( "%lu\n", total );
39}
40
41// Local Variables: //
42// tab-width: 4 //
43// End: //
Note: See TracBrowser for help on using the repository browser.