hpcflow.sdk.log.TimeIt#
- class hpcflow.sdk.log.TimeIt(name=None)#
Bases:
objectMethod execution time instrumentation.
Methods
Decorator for a method that is to have its execution time monitored.
Return command time not classified as work or child orchestration.
Return reported user/application work within the command.
Return orchestration time for this process, excluding child processes.
Return orchestration time including child hpcflow processes.
Return total wall time for this hpcflow process.
Produce a human-readable summary of execution timing statistics.
Attributes
time.perf_counterassigned at the CLI exit point if active.time.perf_counterassigned at the CLI entry point if active.Whether the instrumentation is active.
Time spent to launch the app, if set, and if instrumentation is active.
Time spent by child app processes on orchestration overhead.
Time spent by child app processes on doing work (i.e. script evaluation).
File mode for when summarising to a file
Where to log to.
Preamble to write to the summary file, if requested.
Time spent executing the run command, assigned in
Workflow.execute_runif active.The details be tracked.
Title to be printed with the summary.
Traces of the stack.
Trace indices.
Preceding trace indices.
Preceding traces.
- Parameters:
name (str | None)
- CLI_start: ClassVar[float | None] = None#
time.perf_counterassigned at the CLI entry point if active.
- app_launch_time: ClassVar[float | None] = None#
Time spent to launch the app, if set, and if instrumentation is active. This is measured from just before the app CLI is invoked in a shell, to the top-level Click command call.
- child_orchestration_time: ClassVar[float] = 0.0#
Time spent by child app processes on orchestration overhead.
- child_work_time: ClassVar[float] = 0.0#
Time spent by child app processes on doing work (i.e. script evaluation)
- classmethod decorator(func)#
Decorator for a method that is to have its execution time monitored.
- classmethod get_command_overhead_time()#
Return command time not classified as work or child orchestration.
- classmethod get_command_work_time()#
Return reported user/application work within the command.
- classmethod get_orchestration_time()#
Return orchestration time for this process, excluding child processes.
- classmethod get_total_orchestration_time()#
Return orchestration time including child hpcflow processes.
- classmethod get_total_time()#
Return total wall time for this hpcflow process.
- classmethod reset()#
- run_command_time: ClassVar[float | None] = None#
Time spent executing the run command, assigned in
Workflow.execute_runif active.
- classmethod summarise_string()#
Produce a human-readable summary of execution timing statistics.
The summary may contain two sections:
1. Overall process timings These describe the wall-clock time associated with launching and running the CLI command:
App launch timeTime elapsed before the CLI callback starts. This includes Python interpreter start-up, module imports, and other application initialisation performed before
CLI_startis recorded.CLI timeTime between entering the CLI callback and completion of the invoked command. This includes app orchestration as well as execution of the command itself.
Command timeWall-clock time spent executing the external command launched by this process.
Command work timeTime explicitly reported by the child process as application/user work. For generated Python scripts this is the time spent executing the user-defined function, excluding framework setup, input preparation, output handling, and imports.
Command overhead timeThe part of
Command timenot accounted for by reported user work or child orchestration:- Command overhead
= Command time - Child orchestration time - Command work time
This can include process and interpreter start-up, shell/environment activation, process shutdown, and other execution overhead outside the instrumented child process. For example, activation of a conda environment.
Orchestration timeApp orchestration performed by this process, excluding the external command execution itself.
Child orchestration timeFramework/script orchestration explicitly reported by child processes. For generated Python scripts this includes imports, framework setup, input preparation, and output handling, but excludes the timed user work.
Total orchestration timeOrchestration performed by this process and its instrumented child processes:
- Total orchestration
= Orchestration time + Child orchestration time
Total timeTotal wall-clock time from application launch to completion of the CLI command:
- Total time
= App launch time + CLI time
When child work timing is available, this can also be decomposed as:
- Total time
= Total orchestration time + Command work time + Command overhead time
2. Instrumented timing tree The table reports timings collected by
TimeItdecorators and context managers.sumis the accumulated inclusive time for a named timer;mean,stddev,min, andmaxdescribe its individual invocations, andNis the number of invocations.Tree indentation represents dynamic nesting of timers. Parent timings are inclusive of their child timings, so values in the tree should not generally be added together. Time spent directly in a parent can be estimated by subtracting its child timings from the parent timing.
Some fields are omitted when the information required to calculate them is unavailable. In particular, command work and command overhead require timing information reported by an instrumented child process.
- Return type:
None