Ignore:
Timestamp:
Apr 15, 2017, 7:09:59 PM (4 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
c57d1935
Parents:
308880c
Message:

Minor cleanup, also filled in benchmark source appendix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/generic_types/evaluation/bench.hpp

    r308880c ra381b46  
    11#pragma once
    2 
    32#include <iomanip>
    43#include <iostream>
    54#include <time.h>
    65
    7 #ifndef N
     6long ms_between(clock_t start, clock_t end) { return (end - start) / (CLOCKS_PER_SEC / 1000); }
     7
    88static const int N = 40000000;
    9 #endif
    10 
    11 long ms_between(clock_t start, clock_t end) {
    12         return (end - start) / (CLOCKS_PER_SEC / 1000);
    13 }
    14 
    159#define TIMED(name, code) { \
    1610        volatile clock_t _start, _end; \
     
    1812        code \
    1913        _end = clock(); \
    20         std::cout << name << ":\t" << std::setw(8) << ms_between(_start, _end) << std::setw(0) << " ms" << std::endl; \
     14        std::cout << name << ":\t" << std::setw(8) << ms_between(_start, _end) \
     15                << std::setw(0) << " ms" << std::endl; \
    2116}
    22 
    2317#define REPEAT_N_TIMED(name, n, code) TIMED( name, for (int _i = 0; _i < n; ++_i) { code } )
    24 
    2518#define REPEAT_TIMED(name, code) REPEAT_N_TIMED(name, N, code)
Note: See TracChangeset for help on using the changeset viewer.