https://github.com/halide/Halide
Raw File
Tip revision: a2387dd92e5a9f664600dadd06a6fa2797d3060d authored by Andrew Adams on 06 February 2024, 19:38:35 UTC
Merge branch 'abadams/validate_gpu_schedules' of https://github.com/halide/Halide into abadams/validate_gpu_schedules
Tip revision: a2387dd
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