Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/benchmark/bench.h

    rd67cdb7 rb7170a64  
    11#pragma once
    22
    3 #ifdef __CFORALL__
     3#if defined(__CFORALL__)
    44extern "C" {
    55#endif
     6        #include <stdlib.h>
    67        #include <unistd.h>                                     // sysconf
    78        #include <sys/times.h>                                  // times
    89        #include <time.h>
    9 #ifdef __CFORALL__
     10#if defined(__CFORALL__)
    1011}
    1112#endif
     
    2728} // Time
    2829
    29 #ifndef N
    30 #define N 10000000
     30#ifndef BENCH_N
     31#define BENCH_N 500 //10000000
    3132#endif
     33
     34#define BENCH(statement, output)                \
     35        size_t n = BENCH_N;                     \
     36        if( argc > 2 ) return 1;                \
     37        if( argc == 2 ) {                               \
     38                n = atoi(argv[1]);              \
     39        }                                               \
     40        long long int StartTime, EndTime;       \
     41        StartTime = Time();                     \
     42        statement;                                      \
     43        EndTime = Time();                               \
     44        unsigned long long int output =         \
     45        ( EndTime - StartTime ) / n;
    3246
    3347unsigned int default_preemption() {
Note: See TracChangeset for help on using the changeset viewer.