Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
dCache
cta
Commits
add199b5
Commit
add199b5
authored
6 years ago
by
Eric Cano
Browse files
Options
Downloads
Patches
Plain Diff
Added support for increment to timings in TimingsLists.
parent
63542944
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/log/TimingList.cpp
+19
-2
19 additions, 2 deletions
common/log/TimingList.cpp
common/log/TimingList.hpp
+4
-1
4 additions, 1 deletion
common/log/TimingList.hpp
with
23 additions
and
3 deletions
common/log/TimingList.cpp
+
19
−
2
View file @
add199b5
...
...
@@ -31,14 +31,31 @@ void TimingList::addToLog(ScopedParamContainer& spc) {
}
}
void
TimingList
::
insert
(
const
std
::
string
&
name
,
double
value
)
{
push_back
(
std
::
make_tuple
(
name
,
value
));
double
&
TimingList
::
at
(
const
std
::
string
&
name
)
{
for
(
auto
&
e
:
*
this
)
{
if
(
std
::
get
<
0
>
(
e
)
==
name
)
return
std
::
get
<
1
>
(
e
);
}
throw
std
::
out_of_range
(
"In TimingList::at(): no such element."
);
}
void
TimingList
::
insertOrIncrement
(
const
std
::
string
&
name
,
double
value
)
{
try
{
at
(
name
)
+=
value
;
}
catch
(
std
::
out_of_range
&
)
{
push_back
(
std
::
make_tuple
(
name
,
value
));
}
}
void
TimingList
::
insOrIncAndReset
(
const
std
::
string
&
name
,
utils
::
Timer
&
t
)
{
insertOrIncrement
(
name
,
t
.
secs
(
utils
::
Timer
::
resetCounter
));
}
void
TimingList
::
insertAndReset
(
const
std
::
string
&
name
,
utils
::
Timer
&
t
)
{
push_back
(
std
::
make_tuple
(
name
,
t
.
secs
(
utils
::
Timer
::
resetCounter
)));
}
TimingList
&
TimingList
::
operator
+=
(
const
TimingList
&
other
)
{
for
(
auto
&
ot
:
other
)
{
std
::
string
oName
;
...
...
This diff is collapsed.
Click to expand it.
common/log/TimingList.hpp
+
4
−
1
View file @
add199b5
...
...
@@ -32,10 +32,13 @@ class ScopedParamContainer;
class
TimingList
:
public
std
::
list
<
std
::
tuple
<
std
::
string
,
double
>>
{
public:
void
insert
(
const
std
::
string
&
,
double
);
void
insertOrIncrement
(
const
std
::
string
&
,
double
);
void
insOrIncAndReset
(
const
std
::
string
&
,
utils
::
Timer
&
);
void
insertAndReset
(
const
std
::
string
&
,
utils
::
Timer
&
);
TimingList
&
operator
+=
(
const
TimingList
&
);
void
addToLog
(
ScopedParamContainer
&
);
private:
double
&
at
(
const
std
::
string
&
);
};
}}
// namespace cta::log
\ No newline at end of file
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