You are reading the documentation for version 3.0 of ProMod3.
You may also want to read the documentation for:
1.3
2.0
2.1
3.1
3.2
Runtime profiling
-
class
promod3.core. StaticRuntimeProfiler
Defines functionality for runtime profiling.
All profiling is completely turned off by default and must be activated at
compile-time by adding -DPM3_RUNTIME_PROFILING_LEVEL=N to your CMake
call, where N must be larger than 0. If turned off, all these functions
will still exist and work but will not do anything. Functionality in the C++
code is usually profiled at level 2, while Python functionality is profiled
at level 1. The default profiling only covers the steps of the modelling
pipeline.
You can start multiple timers with the same id and statistics will be
generated considering the number of timings and the total runtime for that
timer. If a timer within another timed entity, the outer timer is paused,
while the inner one is running. Hence, the sum of all timers will be the
total time spent in any timer (nothing is counted twice!).
-
static
Start (id, level=1)
Start a timer for the given id. This pauses any other currently running
timer.
Parameters: |
- id (
str ) – Identifier for this timer.
- level (
int ) – Timer only started if level <= PM3_RUNTIME_PROFILING_LEVEL
|
-
static
StartScoped (id, level=1)
Start a timer for the given id as in Start() , but this will stop it
automatically when the returned variable goes out of scope.
Parameters: |
- id (
str ) – Identifier for this timer.
- level (
int ) – Timer only started if level <= PM3_RUNTIME_PROFILING_LEVEL
|
Returns: | Object that will call Stop() when it goes out of scope
|
-
static
Stop (id, level=1)
Stop the currently running timer. If a timer was paused when starting this
timer, it will be resumed now. Note that there is no error checking here, so
this will fail miserably if no timer is currently running.
Parameters: | level (int ) – Timer only stopped if level <= PM3_RUNTIME_PROFILING_LEVEL |
-
static
PrintSummary (max_to_show=-1)
Display a summary of all timed entities. The timers are collected by id and
sorted by total runtime. If more than 10 entries are shown and the used id’s
have the form “GROUP::NAME”, an additional summary is shown with the total
times spent in each “GROUP”.
Parameters: | max_to_show (int ) – if >= 0, show only top max_to_show entries. |
-
static
IsEnabled ()
Returns: | True, if PM3_RUNTIME_PROFILING_LEVEL > 0. Otherwise, profiling
is completely turned off. |
Return type: | bool |
-
static
Clear ()
Clears all timed entries. Note that there is no error checking here, so this
will fail miserably if timers are currently running.
|