IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
corsika
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue 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
Air Shower Physics
corsika
Commits
ae8fdff7
Commit
ae8fdff7
authored
4 years ago
by
Dominik Baack
Committed by
Ralf Ulrich
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Modified ExecTime to better handle different processes
parent
b0f9ac7b
No related branches found
No related tags found
1 merge request
!253
Add benchmark processor and dummy processors
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Processes/DevTools/Analytics/ExecTime.h
+81
-14
81 additions, 14 deletions
Processes/DevTools/Analytics/ExecTime.h
with
81 additions
and
14 deletions
Processes/DevTools/Analytics/ExecTime.h
+
81
−
14
View file @
ae8fdff7
...
...
@@ -22,10 +22,10 @@ namespace corsika::process {
namespace
devtools
{
template
<
typename
T
>
class
ExecTime
:
pr
iva
te
T
{
class
_
ExecTime
Impl
:
pr
otec
te
d
T
{
private:
std
::
chrono
::
high_resolution_clock
::
time_point
startTime_
;
std
::
chrono
::
duration
<
double
,
std
::
micro
>
cumulatedTime_
;
std
::
chrono
::
duration
<
double
,
std
::
micro
>
cumulatedTime_
;
double
mean_
;
double
mean2_
;
double
min_
;
...
...
@@ -34,7 +34,7 @@ namespace corsika::process {
protected:
public:
ExecTime
()
{
_
ExecTime
Impl
()
{
min_
=
std
::
numeric_limits
<
long
long
>::
max
();
max_
=
0
;
mean_
=
0
;
...
...
@@ -45,8 +45,9 @@ namespace corsika::process {
void
start
()
{
startTime_
=
std
::
chrono
::
high_resolution_clock
::
now
();
}
void
stop
()
{
auto
end
=
std
::
chrono
::
high_resolution_clock
::
now
();
std
::
chrono
::
duration
<
double
,
std
::
micro
>
timeDiv
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
duration
<
double
,
std
::
micro
>
>
(
end
-
startTime_
);
std
::
chrono
::
duration
<
double
,
std
::
micro
>
timeDiv
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
duration
<
double
,
std
::
micro
>
>
(
end
-
startTime_
);
cumulatedTime_
+=
timeDiv
;
n_
=
n_
+
1
;
...
...
@@ -68,7 +69,18 @@ namespace corsika::process {
double
max
()
const
{
return
max_
;
}
double
var
()
const
{
return
mean2_
/
n_
;
}
double
sumTime
()
const
{
return
cumulatedTime_
.
count
();
}
};
template
<
class
T
,
bool
TCheck
>
class
Boundary
;
template
<
class
T
>
class
Boundary
<
T
,
false
>
{};
template
<
class
T
>
class
Boundary
<
T
,
true
>
:
public
_ExecTimeImpl
<
T
>
{
private:
public:
template
<
typename
Particle
,
typename
VTNType
>
EProcessReturn
DoBoundaryCrossing
(
Particle
&
p
,
VTNType
const
&
from
,
VTNType
const
&
to
)
{
...
...
@@ -77,7 +89,18 @@ namespace corsika::process {
this
->
stop
();
return
r
;
}
};
template
<
class
T
,
bool
TCheck
>
class
Continuous
;
template
<
class
T
>
class
Continuous
<
T
,
false
>
{};
template
<
class
T
>
class
Continuous
<
T
,
true
>
:
public
_ExecTimeImpl
<
T
>
{
private:
public:
template
<
typename
Particle
,
typename
Track
>
EProcessReturn
DoContinuous
(
Particle
&
p
,
Track
const
&
t
)
const
{
this
->
start
();
...
...
@@ -93,7 +116,18 @@ namespace corsika::process {
this
->
stop
();
return
r
;
}
};
template
<
class
T
,
bool
TCheck
>
class
Decay
;
template
<
class
T
>
class
Decay
<
T
,
false
>
{};
template
<
class
T
>
class
Decay
<
T
,
true
>
:
public
_ExecTimeImpl
<
T
>
{
private:
public:
template
<
typename
Particle
>
EProcessReturn
DoDecay
(
Particle
&
p
)
{
this
->
start
();
...
...
@@ -109,7 +143,18 @@ namespace corsika::process {
this
->
stop
();
return
r
;
}
};
template
<
class
T
,
bool
TCheck
>
class
Interaction
;
template
<
class
T
>
class
Interaction
<
T
,
false
>
{};
template
<
class
T
>
class
Interaction
<
T
,
true
>
:
public
_ExecTimeImpl
<
T
>
{
private:
public:
template
<
typename
Particle
>
EProcessReturn
DoInteraction
(
Particle
&
p
)
{
this
->
start
();
...
...
@@ -125,7 +170,18 @@ namespace corsika::process {
this
->
stop
();
return
r
;
}
};
template
<
class
T
,
bool
TCheck
>
class
Secondaries
;
template
<
class
T
>
class
Secondaries
<
T
,
false
>
{};
template
<
class
T
>
class
Secondaries
<
T
,
true
>
:
public
_ExecTimeImpl
<
T
>
{
private:
public:
template
<
typename
Secondaries
>
inline
EProcessReturn
DoSecondaries
(
Secondaries
&
sec
)
{
this
->
start
();
...
...
@@ -133,15 +189,26 @@ namespace corsika::process {
this
->
stop
();
return
r
;
}
/*
// Stack
template <
typename TStack,
typename std::enable_if_t<
std::is_base_of<StackProcess<typename T::_TDerived>, T>::type,
int> = 0> inline EProcessReturn DoStack(TStack& stack) { return T::stack(stack);
}*/
};
template
<
typename
T
>
class
ExecTime
:
public
Boundary
<
T
,
std
::
is_base_of
<
corsika
::
process
::
BoundaryCrossingProcess
<
typename
T
::
_TDerived
>
,
T
>::
value
>
,
public
Continuous
<
T
,
std
::
is_base_of
<
corsika
::
process
::
ContinuousProcess
<
typename
T
::
_TDerived
>
,
T
>::
value
>
,
public
Decay
<
T
,
std
::
is_base_of
<
corsika
::
process
::
DecayProcess
<
typename
T
::
_TDerived
>
,
T
>::
value
>
,
public
Interaction
<
T
,
std
::
is_base_of
<
corsika
::
process
::
InteractionProcess
<
typename
T
::
_TDerived
>
,
T
>::
value
>
,
public
Interaction
<
T
,
std
::
is_base_of
<
corsika
::
process
::
Secondaries
<
typename
T
::
_TDerived
>
,
T
>::
value
>
{};
}
// namespace devtools
}
// namespace corsika::process
\ 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