source: benchmark/basic/tls_fetch_add.c @ b4107c8

arm-ehenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulation
Last change on this file since b4107c8 was b4107c8, checked in by Peter A. Buhr <pabuhr@…>, 3 years ago

update existing benchmarks for changes to bench.h, add new benchmarks in new programming languages

  • Property mode set to 100644
File size: 603 bytes
Line 
1#include <stdbool.h>
2#include <stdio.h>
3
4#include "bench.h"
5
6#define thread_local _Thread_local
7
8thread_local volatile bool value;
9
10void __attribute__((noinline)) do_call() {
11        __atomic_store_n( &value, true, __ATOMIC_RELAXED );
12        __atomic_signal_fence(__ATOMIC_ACQUIRE);
13        asm volatile ("");
14        __atomic_store_n( &value, false, __ATOMIC_RELAXED );
15        __atomic_signal_fence(__ATOMIC_RELEASE);
16}
17
18int main( int argc, char * argv[] ) {
19        BENCH_START()
20        BENCH(
21                for (size_t i = 0; i < times; i++) {
22                        do_call();
23                },
24                result
25        )
26        printf( "%g\n", result );
27}
28
29// Local Variables: //
30// tab-width: 4 //
31// End: //
Note: See TracBrowser for help on using the repository browser.