https://github.com/halide/Halide
Raw File
Tip revision: d7651f4b32f9dbd764f243134001f7554378d62d authored by Steven Johnson on 01 March 2023, 00:29:17 UTC
Backport #7315 and #7380 to release/15.x branch (#7383)
Tip revision: d7651f4
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