mirror of
https://github.com/ml-explore/mlx.git
synced 2025-10-19 00:04:41 +08:00
angelos's commit files
This commit is contained in:
18
examples/cpp/timer.h
Normal file
18
examples/cpp/timer.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace timer {
|
||||
|
||||
using namespace std::chrono;
|
||||
|
||||
template <typename R, typename P>
|
||||
inline double seconds(duration<R, P> x) {
|
||||
return duration_cast<nanoseconds>(x).count() / 1e9;
|
||||
}
|
||||
|
||||
inline auto time() {
|
||||
return high_resolution_clock::now();
|
||||
}
|
||||
|
||||
} // namespace timer
|
Reference in New Issue
Block a user