source:
benchmark/Monitor.c
@
16ba4897
Last change on this file since 16ba4897 was 200fcb3, checked in by , 6 years ago | |
---|---|
|
|
File size: 531 bytes |
Rev | Line | |
---|---|---|
[73abe95] | 1 | #include <fstream.hfa> |
2 | #include <stdlib.hfa> | |
3 | #include <thread.hfa> | |
[29137d3] | 4 | |
[8cb6fcd] | 5 | #include "bench.h" |
[29137d3] | 6 | |
7 | monitor mon_t {}; | |
8 | ||
9 | mon_t mon1, mon2; | |
10 | ||
[e0b8ccd5] | 11 | void dummy( mon_t * mutex a ) {} |
[29137d3] | 12 | void dummy( mon_t * mutex a, mon_t * mutex b ) {} |
13 | ||
14 | int main() { | |
15 | long long int StartTime, EndTime; | |
16 | ||
[e0b8ccd5] | 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 | ||
[29137d3] | 25 | StartTime = Time(); |
26 | for( int i = 0; i < N; i++ ) { | |
27 | dummy( &mon1, &mon2 ); | |
28 | } | |
29 | EndTime = Time(); | |
30 | ||
[200fcb3] | 31 | sout | ( EndTime - StartTime ) / N; |
32 | } |
Note: See TracBrowser
for help on using the repository browser.