This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
VectorSearch/timer.cpp

18 lines
434 B
C++

#include "timer.h"
#include <chrono>
#include <iostream>
Timer::Timer(std::string_view name) : name_(name) { start(); };
void Timer::start() { start_ = std::chrono::high_resolution_clock::now(); }
void Timer::stop() {
auto end = std::chrono::high_resolution_clock::now();
auto duration =
std::chrono::duration_cast<std::chrono::microseconds>(end - start_);
std::cout << name_ << " took " << duration << std::endl;
}