mirror of
				https://github.com/ml-explore/mlx.git
				synced 2025-11-04 02:28:13 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			21 lines
		
	
	
		
			332 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			332 B
		
	
	
	
		
			C++
		
	
	
	
	
	
// Copyright © 2023 Apple Inc.
 | 
						|
 | 
						|
#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
 |