Revision c54f4a4e9bbff4666cb49827bad490e6e78e2236 authored by Andrew Adams on 10 December 2021, 13:12:56 UTC, committed by Andrew Adams on 10 December 2021, 13:12:56 UTC
1 parent 8251c5b
Raw File
clock.h
#ifndef HALIDE_TUTORIAL_CLOCK_H
#define HALIDE_TUTORIAL_CLOCK_H

// A current_time function for use in the tests.  Returns time in
// milliseconds.

#include "halide_benchmark.h"

inline double current_time() {
    static auto start_time = Halide::Tools::benchmark_now().time_since_epoch();

    auto now = Halide::Tools::benchmark_now().time_since_epoch() - start_time;
    return std::chrono::duration_cast<std::chrono::microseconds>(now).count() / 1e3;
}

#endif  // HALIDE_TUTORIAL_CLOCK_H
back to top