Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
7d1069bb
There was an error fetching the commit references. Please try again later.
Commit
7d1069bb
authored
6 years ago
by
Jakub Klinkovský
Browse files
Options
Downloads
Patches
Plain Diff
Moved stuff from Timer.cpp to Timer_impl.h
parent
b91b9403
No related branches found
No related tags found
1 merge request
!22
Header only
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/TNL/CMakeLists.txt
+2
-2
2 additions, 2 deletions
src/TNL/CMakeLists.txt
src/TNL/Timer.h
+1
-2
1 addition, 2 deletions
src/TNL/Timer.h
src/TNL/Timer_impl.h
+15
-15
15 additions, 15 deletions
src/TNL/Timer_impl.h
with
18 additions
and
19 deletions
src/TNL/CMakeLists.txt
+
2
−
2
View file @
7d1069bb
...
...
@@ -35,12 +35,12 @@ set( headers
StaticFor.h
String.h
Timer.h
Timer_impl.h
StaticVectorFor.h
)
set
(
common_SOURCES
FileName.cpp
String.cpp
Timer.cpp
)
String.cpp
)
set
(
tnl_SOURCES
${
tnl_config_SOURCES
}
${
tnl_containers_SOURCES
}
...
...
This diff is collapsed.
Click to expand it.
src/TNL/Timer.h
+
1
−
2
View file @
7d1069bb
...
...
@@ -132,7 +132,6 @@ class Timer
}
};
extern
Timer
defaultTimer
;
}
// namespace TNL
#include
<TNL/Timer_impl.h>
This diff is collapsed.
Click to expand it.
src/TNL/Timer
.cpp
→
src/TNL/Timer
_impl.h
+
15
−
15
View file @
7d1069bb
/***************************************************************************
Timer
.cpp
- description
Timer
_impl.h
- description
-------------------
begin : Mar 14, 2016
copyright : (C) 2016 by Tomas Oberhuber
...
...
@@ -8,6 +8,8 @@
/* See Copyright Notice in tnl/Copyright */
#pragma once
#include
<TNL/Timer.h>
#include
<TNL/Logger.h>
...
...
@@ -19,14 +21,12 @@
namespace
TNL
{
Timer
defaultTimer
;
Timer
::
Timer
()
inline
Timer
::
Timer
()
{
reset
();
}
void
Timer
::
reset
()
inline
void
Timer
::
reset
()
{
this
->
initialCPUTime
=
0
;
this
->
totalCPUTime
=
0.0
;
...
...
@@ -37,7 +37,7 @@ void Timer::reset()
this
->
stopState
=
true
;
}
void
Timer
::
stop
()
inline
void
Timer
::
stop
()
{
if
(
!
this
->
stopState
)
...
...
@@ -49,7 +49,7 @@ void Timer::stop()
}
}
void
Timer
::
start
()
inline
void
Timer
::
start
()
{
this
->
initialRealTime
=
this
->
readRealTime
();
this
->
initialCPUTime
=
this
->
readCPUTime
();
...
...
@@ -57,33 +57,33 @@ void Timer::start()
this
->
stopState
=
false
;
}
double
Timer
::
getRealTime
()
const
inline
double
Timer
::
getRealTime
()
const
{
if
(
!
this
->
stopState
)
return
durationToDouble
(
this
->
readRealTime
()
-
this
->
initialRealTime
);
return
durationToDouble
(
this
->
totalRealTime
);
}
double
Timer
::
getCPUTime
()
const
inline
double
Timer
::
getCPUTime
()
const
{
if
(
!
this
->
stopState
)
return
this
->
readCPUTime
()
-
this
->
initialCPUTime
;
return
this
->
totalCPUTime
;
}
unsigned
long
long
int
Timer
::
getCPUCycles
()
const
inline
unsigned
long
long
int
Timer
::
getCPUCycles
()
const
{
if
(
!
this
->
stopState
)
return
this
->
readCPUCycles
()
-
this
->
initialCPUCycles
;
return
this
->
totalCPUCycles
;
}
typename
Timer
::
TimePoint
Timer
::
readRealTime
()
const
inline
typename
Timer
::
TimePoint
Timer
::
readRealTime
()
const
{
return
std
::
chrono
::
high_resolution_clock
::
now
();
}
double
Timer
::
readCPUTime
()
const
inline
double
Timer
::
readCPUTime
()
const
{
#if !defined(_WIN32) && !defined(_WIN64)
rusage
initUsage
;
...
...
@@ -94,19 +94,19 @@ double Timer::readCPUTime() const
#endif
}
unsigned
long
long
int
Timer
::
readCPUCycles
()
const
inline
unsigned
long
long
int
Timer
::
readCPUCycles
()
const
{
return
this
->
rdtsc
();
}
double
Timer
::
durationToDouble
(
const
Duration
&
duration
)
const
inline
double
Timer
::
durationToDouble
(
const
Duration
&
duration
)
const
{
std
::
chrono
::
duration
<
double
>
dur
(
duration
);
return
dur
.
count
();
}
bool
Timer
::
writeLog
(
Logger
&
logger
,
int
logLevel
)
const
inline
bool
Timer
::
writeLog
(
Logger
&
logger
,
int
logLevel
)
const
{
logger
.
writeParameter
<
double
>
(
"Real time:"
,
this
->
getRealTime
(),
logLevel
);
logger
.
writeParameter
<
double
>
(
"CPU time:"
,
this
->
getCPUTime
(),
logLevel
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment