ADT
        arm-eh
        ast-experimental
        enum
        forall-pointer-decay
        jacob/cs343-translation
        jenkins-sandbox
        new-ast
        new-ast-unique-expr
        pthread-emulation
        qualifiedEnum
      
      
        
          | Last change
 on this file since 1c40091 was             dc33b5b, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago | 
        
          | 
update benchmarks and add benchmarks for qthreads
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            526 bytes | 
      
      
| Rev | Line |  | 
|---|
| [7a8f5246] | 1 | #include <stdbool.h> | 
|---|
|  | 2 | #include <stdio.h> | 
|---|
|  | 3 |  | 
|---|
|  | 4 | #include "bench.h" | 
|---|
|  | 5 |  | 
|---|
|  | 6 | #define thread_local _Thread_local | 
|---|
|  | 7 |  | 
|---|
| [54db6ba] | 8 | thread_local volatile bool value; | 
|---|
| [7a8f5246] | 9 |  | 
|---|
|  | 10 | void __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 |  | 
|---|
|  | 18 | int main(int argc, char* argv[]) { | 
|---|
|  | 19 | BENCH( | 
|---|
|  | 20 | for (size_t i = 0; i < n; i++) { | 
|---|
|  | 21 | do_call(); | 
|---|
|  | 22 | }, | 
|---|
|  | 23 | result | 
|---|
|  | 24 | ) | 
|---|
|  | 25 |  | 
|---|
| [dc33b5b] | 26 | printf("%g\n", result); | 
|---|
| [7a8f5246] | 27 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.