11 from basf2
import Path, process, statistics
17 eventinfosetter = main.add_module(
'EventInfoSetter',
18 expList=[71, 71, 73, 73, 73],
19 runList=[3, 4, 10, 20, 30],
20 evtNumList=[40, 600, 20, 500, 301])
22 eventinfo = main.add_module(
'EventInfoPrinter')
28 print(
'Event Statistics:')
32 print(
'Event Statistics for selected modules:')
33 print(statistics([eventinfosetter]))
36 print(
'Total processing times:')
37 print(statistics(statistics.TOTAL))
40 statistics.set_name(eventinfosetter,
'Foo')
43 statistic_counters = [
44 (statistics.INIT,
"initialize()"),
45 (statistics.BEGIN_RUN,
"beginRun()"),
46 (statistics.EVENT,
"event()"),
47 (statistics.END_RUN,
"endRun()"),
48 (statistics.TERM,
"terminate()"),
49 (statistics.TOTAL,
"*total*"),
53 for stats
in statistics.modules:
54 print(
'Module %s:' % stats.name)
55 for stat_counter, stat_name
in statistic_counters:
56 print(
' -> %12s: %10.3f ms, %4d calls, %10.3f +-%10.3f ms/call' % (
59 stats.time_sum(stat_counter) / 1e6,
60 stats.calls(stat_counter),
61 stats.time_mean(stat_counter) / 1e6,
62 stats.time_stddev(stat_counter) / 1e6,
66 print(
'Memory statistics')
67 for stats
in statistics.modules:
68 print(
'Module %s:' % stats.name)
69 for stat_counter, stat_name
in statistic_counters:
70 print(
' -> %12s: %10d KB, %4d calls, %10d +-%10.3f KB/call' % (
72 stats.memory_sum(stat_counter),
73 stats.calls(stat_counter),
74 stats.memory_mean(stat_counter),
75 stats.memory_stddev(stat_counter),
79 stats = statistics.get(eventinfosetter)
80 eventinfo_total = stats.time_sum(statistics.TOTAL)
81 print(
'EventInfoSetter needed %.3f ms in total' % (eventinfo_total / 1e6))
86 framework_total = statistics.get_global().time_sum(statistics.TOTAL)
87 print(
'Total processing time: %.3f ms' % (framework_total / 1e6))
90 modules_total = sum(e.time_sum(statistics.TOTAL)
for e
in statistics.modules)
91 overhead = framework_total - modules_total
92 print(
'Framework overhead: %.3f ms (%.2f %%)' % (
94 100 * overhead / framework_total,
100 print(
'Empty statistics')