Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Frederik Hennig
waLBerla
Commits
16dbd21e
Commit
16dbd21e
authored
Jun 14, 2018
by
Christoph Rettinger
Browse files
Added functionality to timers and fixed docu typos
parent
9d28f33b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/core/timing/TimingNode.h
View file @
16dbd21e
...
...
@@ -111,7 +111,7 @@ void TimingNode<TP>::swap(TimingNode<TP>& tt)
}
}
/// Finds the spe
z
ified timer in the timing hierarchy
/// Finds the spe
c
ified timer in the timing hierarchy
/// \param name timer name which may include more than one hierarchy separated by "."
/// \code findTimer(tn, "firstLevel.secondLevel.thirdLevel.timerName"); \endcode
/// \relates TimingNode
...
...
@@ -130,6 +130,31 @@ const Timer<TP>& findTimer( const TimingNode<TP>& tn, const std::string& name)
}
}
/// Checks if the specified timer exists in the timing hierarchy
/// \param name timer name which may include more than one hierarchy separated by "."
/// \code timerExists(tn, "firstLevel.secondLevel.thirdLevel.timerName"); \endcode
/// \relates TimingNode
template
<
typename
TP
>
// Timing policy
bool
timerExists
(
const
TimingNode
<
TP
>&
tn
,
const
std
::
string
&
name
)
{
auto
pos
=
name
.
find_first_of
(
"."
);
if
(
pos
!=
std
::
string
::
npos
)
{
if
(
tn
.
tree_
.
find
(
name
.
substr
(
0
,
pos
))
!=
tn
.
tree_
.
end
()
)
{
return
timerExists
(
tn
.
tree_
.
at
(
name
.
substr
(
0
,
pos
)),
name
.
substr
(
pos
+
1
,
std
::
string
::
npos
));
}
else
{
return
false
;
}
}
else
{
return
tn
.
tree_
.
find
(
name
)
!=
tn
.
tree_
.
end
();
}
}
/// Resets the timer in the TimingNode structure and all sub timers
/// \relates TimingNode
template
<
typename
TP
>
// Timing policy
...
...
src/core/timing/TimingTree.h
View file @
16dbd21e
...
...
@@ -59,13 +59,13 @@ public:
void
swap
(
TimingTree
<
TP
>&
tt
);
/// Starts a timer beneath the current hirarchy level
/// Starts a timer beneath the current hi
e
rarchy level
void
start
(
const
std
::
string
&
name
);
/// Stops the last started timer and jumps back one hirarchy level
/// Stops the last started timer and jumps back one hi
e
rarchy level
void
stop
(
const
std
::
string
&
name
);
/// Checks if specified timer is currently running.
bool
isTimerRunning
(
const
std
::
string
&
name
)
const
;
/// Resets the the timing hirarchy
/// Resets the the timing hi
e
rarchy
void
reset
();
//** Reduction ******************************************************************************************************
...
...
@@ -81,7 +81,9 @@ public:
/// Returns the raw tree data structure
const
TimingNode
<
TP
>&
getRawData
()
const
;
const
Timer
<
TP
>&
operator
[](
const
std
::
string
&
name
)
const
;
inline
bool
timerExists
(
const
std
::
string
&
n
)
const
;
/// Returns the name of the currently running timer
/// Might be expensive due to value search.
...
...
@@ -89,7 +91,7 @@ public:
private:
/// Tree data structure
TimingNode
<
TP
>
root_
;
/// Pointer to the current hirarchy level.
/// Pointer to the current hi
e
rarchy level.
TimingNode
<
TP
>*
current_
;
};
...
...
@@ -204,7 +206,7 @@ const TimingNode<TP>& TimingTree<TP>::getRawData() const
return
root_
;
}
/// Finds the spe
z
ified timer in the timing hierarchy
/// Finds the spe
c
ified timer in the timing hierarchy
/// \param name timer name which may include more than one hierarchy separated by "."
/// \code tt["firstLevel.secondLevel.thirdLevel.timerName"].total(); \endcode
template
<
typename
TP
>
// Timing policy
...
...
@@ -213,6 +215,15 @@ const Timer<TP>& TimingTree<TP>::operator[](const std::string& name) const
return
findTimer
(
root_
,
name
);
}
/// Checks if the specified timer exists in the timing hierarchy
/// \param name timer name which may include more than one hierarchy separated by "."
/// \code tt.timerExists("firstLevel.secondLevel.thirdLevel.timerName"); \endcode
template
<
typename
TP
>
// Timing policy
bool
TimingTree
<
TP
>::
timerExists
(
const
std
::
string
&
name
)
const
{
return
walberla
::
timing
::
timerExists
(
root_
,
name
);
}
template
<
typename
TP
>
// Timing policy
std
::
string
TimingTree
<
TP
>::
getCurrentTimerName
()
const
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment