source: src/benchmark/Monitor.c@ 5fcba14

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 5fcba14 was e0b8ccd5, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

Monitor benchmarks now compare 1 and 2 monitors

  • Property mode set to 100644
File size: 525 bytes
Line 
1#include <fstream>
2#include <stdlib>
3#include <thread>
4
5#include "bench.h"
6
7monitor mon_t {};
8
9mon_t mon1, mon2;
10
11void dummy( mon_t * mutex a ) {}
12void dummy( mon_t * mutex a, mon_t * mutex b ) {}
13
14int main() {
15 long long int StartTime, EndTime;
16
17 StartTime = Time();
18 for( int i = 0; i < N; i++ ) {
19 dummy( &mon1 );
20 }
21 EndTime = Time();
22
23 sout | ( EndTime - StartTime ) / N;
24
25 StartTime = Time();
26 for( int i = 0; i < N; i++ ) {
27 dummy( &mon1, &mon2 );
28 }
29 EndTime = Time();
30
31 sout | ( EndTime - StartTime ) / N | endl;
32}
Note: See TracBrowser for help on using the repository browser.