https://github.com/halide/Halide
Raw File
Tip revision: 4e9f81211163b4dbaf177c0be8510e675154ee77 authored by Andrew Adams on 01 January 2023, 23:01:45 UTC
Merge branch 'abadams/fix_7260' of https://github.com/halide/Halide into abadams/fix_7260
Tip revision: 4e9f812
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