Ignore:
Timestamp:
Oct 26, 2017, 11:17:20 AM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
4149d9d
Parents:
f1dd17a
Message:

renamed and updated benchmarks for consistency

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/benchmark/bench.h

    rf1dd17a r034165a  
    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        const unsigned int NoOfTimes = n;       \
     41        long long int StartTime, EndTime;       \
     42        StartTime = Time();                                     \
     43        statement;                                                      \
     44        EndTime = Time();                                       \
     45        unsigned long long int output =         \
     46        ( EndTime - StartTime ) / NoOfTimes;
    3247
    3348unsigned int default_preemption() {
Note: See TracChangeset for help on using the changeset viewer.