LeechCraft
0.6.70-17335-ge406ffdcaf
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
timer.cpp
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#include "
timer.h
"
10
#include <QtDebug>
11
12
namespace
LC::Util
13
{
14
Timer::Timer
(std::string_view label,
Resolution
resolution)
15
: Label_ { label }
16
, Resolution_ { resolution }
17
{
18
Timer_.start ();
19
}
20
21
Timer::~Timer
()
22
{
23
auto
diff = Timer_.nsecsElapsed ();
24
25
const
char
*unit =
nullptr
;
26
switch
(Resolution_)
27
{
28
case
Resolution::ns
:
29
unit =
"ns"
;
30
break
;
31
case
Resolution::us
:
32
diff /= 1e3;
33
unit =
"us"
;
34
break
;
35
case
Resolution::ms
:
36
diff /= 1e6;
37
unit =
"ms"
;
38
break
;
39
}
40
41
qDebug () << Label_.data ()
// TODO Qt6: no need for data() here
42
<<
"took"
43
<< diff
44
<< unit;
45
}
46
}
LC::Util::Timer::Timer
Timer()
Definition
timer.cpp:14
LC::Util::Timer::Resolution
Resolution
Definition
timer.h:24
LC::Util::Timer::Resolution::us
@ us
Definition
timer.h:26
LC::Util::Timer::Resolution::ms
@ ms
Definition
timer.h:27
LC::Util::Timer::Resolution::ns
@ ns
Definition
timer.h:25
LC::Util::Timer::~Timer
~Timer()
Definition
timer.cpp:21
LC::Util
Definition
icoreproxy.h:34
timer.h
src
util
sys
timer.cpp
Generated by
1.13.2