Ignore:
Timestamp:
Apr 19, 2017, 10:15:45 AM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
cd348e7
Parents:
221c2de (diff), de4ce0e (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
  • doc/generic_types/evaluation/bench.h

    r221c2de r154fdc8  
     1#pragma once
    12#include <stdio.h>
    23#include <time.h>
    34
    4 #define N 200000000
     5long ms_between(clock_t start, clock_t end) { return (end - start) / (CLOCKS_PER_SEC / 1000); }
    56
    6 long ms_between(clock_t start, clock_t end) {
    7         return (end - start) / (CLOCKS_PER_SEC / 1000);
     7#define N 40000000
     8#define TIMED(name, code) { \
     9        volatile clock_t _start, _end; \
     10        _start = clock(); \
     11        code \
     12        _end = clock(); \
     13        printf("%s:\t%8ld ms\n", name, ms_between(_start, _end)); \
    814}
    9 
    10 #define TIMED(name, code) { \
    11         clock_t start, end; \
    12         start = clock(); \
    13         code \
    14         end = clock(); \
    15         printf("%s:\t%7ld ms\n", name, ms_between(start, end)); \
    16 }
    17 
    18 #define REPEAT_TIMED(name, code) TIMED( name, for (int i = 0; i < N; ++i) { code } )
     15#define REPEAT_TIMED(name, n, code) TIMED( name, for (int _i = 0; _i < n; ++_i) { code } )
Note: See TracChangeset for help on using the changeset viewer.