Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
0499a076
Commit
0499a076
authored
4 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
debug utils: improve timer
Change-Id: If08a7cd78de2f792baf7f245b7fcc1acdbd33744
parent
52415a8e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/debug_utils.h
+16
-2
16 additions, 2 deletions
src/debug_utils.h
with
16 additions
and
2 deletions
src/debug_utils.h
+
16
−
2
View file @
0499a076
...
...
@@ -26,16 +26,21 @@
#include
"media_io_handle.h"
#include
"system_codec_container.h"
#include
<opendht/utils.h>
#include
<chrono>
#include
<cstdio>
#include
<fstream>
#include
<ios>
#include
<ratio>
#include
<string_view>
#include
"logger.h"
#warning Debug utilities included in build
using
Clock
=
std
::
chrono
::
steady_clock
;
using
namespace
std
::
literals
;
namespace
jami
{
namespace
debug
{
...
...
@@ -49,16 +54,25 @@ namespace debug {
class
Timer
{
public:
Timer
()
{
start_
=
Clock
::
now
();
}
Timer
(
std
::
string_view
name
)
:
name_
(
name
),
start_
(
Clock
::
now
())
{}
~
Timer
()
{
print
(
"end"
sv
);
}
template
<
class
Period
=
std
::
ratio
<
1
>
>
uint64_t
getDuration
()
uint64_t
getDuration
()
const
{
auto
diff
=
std
::
chrono
::
duration_cast
<
Period
>
(
Clock
::
now
()
-
start_
);
return
diff
.
count
();
}
void
print
(
std
::
string_view
action
)
const
{
JAMI_DBG
()
<<
name_
<<
": "
<<
action
<<
" after "
<<
dht
::
print_duration
(
Clock
::
now
()
-
start_
);
}
private
:
std
::
string_view
name_
;
std
::
chrono
::
time_point
<
Clock
>
start_
;
};
...
...
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