Skip to content

Instantly share code, notes, and snippets.

@jyhsu2000
Last active June 30, 2023 06:31
Show Gist options
  • Save jyhsu2000/20495f051d1a6b63101ef8415d45cdde to your computer and use it in GitHub Desktop.
Save jyhsu2000/20495f051d1a6b63101ef8415d45cdde to your computer and use it in GitHub Desktop.
Aggregate timing data of `codetiming.Timer`
import pandas as pd
from codetiming import Timer
timer_dfs = []
for timer_name in Timer.timers:
timer_dfs.append(pd.DataFrame({
'timer': timer_name,
'count': Timer.timers.count(timer_name),
'total': Timer.timers.total(timer_name),
'min': Timer.timers.min(timer_name),
'max': Timer.timers.max(timer_name),
'mean': Timer.timers.mean(timer_name),
'median': Timer.timers.median(timer_name),
'stdev': Timer.timers.stdev(timer_name),
}, index=[0]))
timer_df = pd.concat(timer_dfs, ignore_index=True)
print(timer_df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment