Ignore:
Timestamp:
Nov 8, 2017, 5:43:33 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, 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:
954908d
Parents:
78315272 (diff), e35f30a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/benchmark/bench.h

    r78315272 r3f7e12cb  
    11#pragma once
    22
     3#if defined(__CFORALL__)
    34extern "C" {
     5#endif
     6        #include <stdlib.h>
    47        #include <unistd.h>                                     // sysconf
    58        #include <sys/times.h>                                  // times
    69        #include <time.h>
     10#if defined(__CFORALL__)
    711}
     12#endif
    813
    9 inline unsigned long long int Time() {
    10     timespec ts;
     14static inline unsigned long long int Time() {
     15    struct timespec ts;
    1116    clock_gettime(
    1217#if defined( __linux__ )
     
    2328} // Time
    2429
    25 #ifndef N
    26 #define N 10000000
     30#ifndef BENCH_N
     31#define BENCH_N 500 //10000000
    2732#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;
    2846
    2947unsigned int default_preemption() {
Note: See TracChangeset for help on using the changeset viewer.