16 from basf2
import Path, process, statistics
22 eventinfosetter = main.add_module(
'EventInfoSetter',
23 expList=[71, 71, 73, 73, 73],
24 runList=[3, 4, 10, 20, 30],
25 evtNumList=[40, 600, 20, 500, 301])
27 eventinfo = main.add_module(
'EventInfoPrinter')
33 print(
'Event Statistics:')
37 print(
'Event Statistics for selected modules:')
38 print(statistics(modules=[eventinfosetter]))
41 print(
'Total processing times:')
42 print(statistics(statistics.TOTAL))
45 statistic_counters = [
46 (statistics.INIT,
"initialize()"),
47 (statistics.BEGIN_RUN,
"beginRun()"),
48 (statistics.EVENT,
"event()"),
49 (statistics.END_RUN,
"endRun()"),
50 (statistics.TERM,
"terminate()"),
51 (statistics.TOTAL,
"*total*"),
55 for stats
in statistics.modules:
56 print(
'Module %s:' % stats.name)
57 for stat_counter, stat_name
in statistic_counters:
58 print(
' -> %12s: %10.3f ms, %4d calls, %10.3f +-%10.3f ms/call' % (
61 stats.time_sum(stat_counter) / 1e6,
62 stats.calls(stat_counter),
63 stats.time_mean(stat_counter) / 1e6,
64 stats.time_stddev(stat_counter) / 1e6,
68 print(
'Memory statistics')
69 for stats
in statistics.modules:
70 print(
'Module %s:' % stats.name)
71 for stat_counter, stat_name
in statistic_counters:
72 print(
' -> %12s: %10d KB, %4d calls, %10d +-%10.3f KB/call' % (
74 stats.memory_sum(stat_counter),
75 stats.calls(stat_counter),
76 stats.memory_mean(stat_counter),
77 stats.memory_stddev(stat_counter),
81 stats = statistics.get(eventinfosetter)
82 eventinfo_total = stats.time_sum(statistics.TOTAL)
83 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} %)'.format(
94 100 * overhead / framework_total,
100 print(
'Empty statistics')