16from basf2
import Path, process, statistics
22eventinfosetter = 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])
27eventinfo = main.add_module(
'EventInfoPrinter')
33print(
'Event Statistics:')
37print(
'Event Statistics for selected modules:')
38print(statistics(modules=[eventinfosetter]))
41print(
'Total processing times:')
42print(statistics(statistics.TOTAL))
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*"),
55for stats
in statistics.modules:
56 print(f
'Module {stats.name}:')
57 for stat_counter, stat_name
in statistic_counters:
58 print(f
' -> {stat_name:12}: {stats.time_sum(stat_counter) / 1e6:10.3f} ms, {int(stats.calls(stat_counter)):4} ' +
59 f
'calls, {stats.time_mean(stat_counter) / 1e6:10.3f} ' +
60 f
'+-{stats.time_stddev(stat_counter) / 1e6:10.3f} ms/call')
64print(
'Memory statistics')
65for stats
in statistics.modules:
66 print(f
'Module {stats.name}:')
67 for stat_counter, stat_name
in statistic_counters:
68 print(f
' -> {stat_name:12}: {int(stats.memory_sum(stat_counter)):10} KB, {int(stats.calls(stat_counter)):4} calls, ' +
69 f
'{int(stats.memory_mean(stat_counter)):10} +-{stats.memory_stddev(stat_counter):10.3f} KB/call')
72stats = statistics.get(eventinfosetter)
73eventinfo_total = stats.time_sum(statistics.TOTAL)
74print(f
'EventInfoSetter needed {eventinfo_total / 1e6:.3f} ms in total')
77framework_total = statistics.get_global().time_sum(statistics.TOTAL)
78print(f
'Total processing time: {framework_total / 1e6:.3f} ms')
81modules_total = sum(e.time_sum(statistics.TOTAL)
for e
in statistics.modules)
82overhead = framework_total - modules_total
83print(f
'Framework overhead: {overhead / 1e6:.3f} ms ({100 * overhead / framework_total:.2f} %)')
88print(
'Empty statistics')