ChronoTimer.h
Go to the documentation of this file.
#pragma once
#include <chrono>
#include <string>
namespace grk
{
class ChronoTimer
{
public:
ChronoTimer(std::string msg) : message(msg) {}
void start(void)
{
startTime = std::chrono::high_resolution_clock::now();
}
void finish(void)
{
auto finish = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = finish - startTime;
GRK_INFO("%s : %f ms", message.c_str(), elapsed.count() * 1000);
}
private:
std::string message;
std::chrono::high_resolution_clock::time_point startTime;
};
} // namespace grk
grk::ChronoTimer
Definition ChronoTimer.h:10
grk::ChronoTimer::ChronoTimer
ChronoTimer(std::string msg)
Definition ChronoTimer.h:12
grk::ChronoTimer::start
void start(void)
Definition ChronoTimer.h:13
grk::ChronoTimer::startTime
std::chrono::high_resolution_clock::time_point startTime
Definition ChronoTimer.h:26
grk::ChronoTimer::message
std::string message
Definition ChronoTimer.h:25
grk::ChronoTimer::finish
void finish(void)
Definition ChronoTimer.h:17
grk
Copyright (C) 2016-2023 Grok Image Compression Inc.
Definition ICacheable.h:20
grk::grk_read
void grk_read(const uint8_t *buffer, TYPE *value, uint32_t numBytes)
Definition BufferedStream.h:239
grk::GRK_INFO
void GRK_INFO(const char *fmt,...)
Definition logger.cpp:40