Direct Graphical Models
v.1.7.0
timer.h
1
// Timer Class Interface
2
// Written by Sergey Kosov in 2015 for Project X
3
#pragma once
4
5
#include "types.h"
6
7
namespace
DirectGraphicalModels
8
{
9
// ================================ Timer Namespace ==============================
14
namespace
Timer
15
{
16
static
int64 m_ticks = 0;
17
22
void
start
(
const
std::string &str)
23
{
24
printf(
"%s "
, str.c_str());
25
m_ticks = getTickCount();
26
}
27
32
void
stop
(
void
)
33
{
34
int64 ms =
static_cast<
int64
>
(1000 * (getTickCount() - m_ticks) / getTickFrequency());
35
int64 sec = 0;
36
int64 min = 0;
37
int64 hrs = 0;
38
39
if
(ms >= 1000) {
40
sec = ms / 1000;
41
ms = ms % 1000;
42
}
43
if
(sec >= 60) {
44
min = sec / 60;
45
sec = sec % 60;
46
}
47
if
(min > 60) {
48
hrs = min / 60;
49
min = min % 60;
50
}
51
52
printf(
"Done! ("
);
53
if
(hrs) printf(
"%lld:"
, hrs);
54
if
(min) printf(
"%lld:"
, min);
55
if
(sec) printf(
"%lld'"
, sec);
56
printf(
"%03lld ms)\n"
, ms);
57
}
58
}
59
}
DirectGraphicalModels
Definition:
AveragePrecision.cpp:4
DirectGraphicalModels::Timer::start
void start(const std::string &str)
Starts the timer.
Definition:
timer.h:22
DirectGraphicalModels::Timer::stop
void stop(void)
Stops the timer.
Definition:
timer.h:32
modules
DGM
timer.h
Generated on Thu Feb 21 2019 13:31:15 for Direct Graphical Models by
1.8.14