LeechCraft
0.6.70-16373-g319c272718
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
/= 1
e3
;
33
unit
=
"us"
;
34
break
;
35
case
Resolution::ms
:
36
diff
/= 1
e6
;
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
LC::Util::Timer::Resolution::ms
@ ms
LC::Util::Timer::Resolution::ns
@ ns
LC::Util::Timer::~Timer
~Timer()
Definition
timer.cpp:21
LC::Util
Definition
icoreproxy.h:34
LC::Util::Filter
Container< T > Filter(const Container< T > &c, F f)
Definition
prelude.h:118
timer.h
src
util
sys
timer.cpp
Generated by
1.10.0