11#!/usr/bin/env python3
22import json
3- transitionTypes = ["construction" , "event" ,
4- "begin job" , "begin stream" ,
5- "global begin run" , "global begin luminosity block" ,
6- "stream begin run" , "stream begin luminosity block" ,
7- ]
3+ transitionTypes = [
4+ "construction" ,
5+ "begin job" ,
6+ "begin stream" ,
7+ "global begin run" ,
8+ "stream begin run" ,
9+ "global begin luminosity block" ,
10+ "stream begin luminosity block" ,
11+ "event" ,
12+ ]
813allocTypes = ["added" , "nAlloc" , "nDealloc" , "maxTemp" , "max1Alloc" ]
914
1015def processModuleTransition (moduleLabel , moduleType , moduleInfo , transitionType , moduleTransition ):
@@ -24,44 +29,44 @@ def formatToCircles(moduleTransitions):
2429 for transitionType in transitionTypes :
2530 doc ["resources" ] += [
2631 {
27- "name" : "added %s" % transitionType ,
28- "description" : " added memory per %s transition" % transitionType ,
29- "title" : "Amount of memory added to the process at the end of the %s transition" % transitionType ,
32+ "name" : f "added { transitionType } " ,
33+ "description" : f" { transitionType } : added memory (average)" ,
34+ "title" : f "Amount of memory added to the process at the end of the { transitionType } transition" ,
3035 "unit" : "kB"
3136 },
3237 {
3338
34- "name" : "nAlloc %s" % transitionType ,
35- "description" : " num allocs per %s transition" % transitionType ,
36- "title" : "Number of allocations during the %s transition" % transitionType ,
39+ "name" : f "nAlloc { transitionType } " ,
40+ "description" : f" { transitionType } : num allocs (average)" ,
41+ "title" : f "Number of allocations during the { transitionType } transition" ,
3742 "unit" : ""
3843 },
3944 {
40- "name" : "max1Alloc %s" % transitionType ,
41- "description" : "maximum one time allocation per %s transition" % transitionType ,
42- "title" : "Maximum one time allocation held during the %s transition" % transitionType ,
43- "unit" : "kB"
44- },
45- {
46- "name" : "nDealloc %s" % transitionType ,
47- "description" : "num deallocs for %s transition" % transitionType ,
48- "title" : "Number of deallocations during the %s transition" % transitionType ,
45+ "name" : f"nDealloc { transitionType } " ,
46+ "description" : f"{ transitionType } : num deallocs (average)" ,
47+ "title" : f"Number of deallocations during the { transitionType } transition" ,
4948 "unit" : ""
50- },
51- {
52- "name" : "maxTemp %s" % transitionType ,
53- "description" : " maximum temporary memory per %s transition" % transitionType ,
54- "title" : "Maximum temporary memory held during the %s transition" % transitionType ,
49+ },
50+ {
51+ "name" : f "maxTemp { transitionType } " ,
52+ "description" : f" { transitionType } : maximum temporary memory (average)" ,
53+ "title" : f "Maximum temporary memory held during the { transitionType } transition" ,
5554 "unit" : "kB"
56- },
55+ },
56+ {
57+ "name" : f"max1Alloc { transitionType } " ,
58+ "description" : f"{ transitionType } : largest single allocation (average)" ,
59+ "title" : f"Largest single allocation held during the { transitionType } transition" ,
60+ "unit" : "kB"
61+ },
5762 ]
58- # The circles code uses the "events" field to normalize the values between files with different number of events
59- # Here we set it to 1 for the total events because the total is already normalized per transition
63+ # The circles code uses the "events" field to normalize the values between files with different number of events
64+ # Here we set it to 1 for the total events because the total is already normalized per transition
6065 doc ["total" ]["events" ] = 1
6166 doc ["total" ]["label" ] = "Job"
6267 doc ["total" ]["type" ] = "Job"
6368 for allocType in allocTypes :
64- doc ["total" ]["%s %s" % ( allocType , transitionType ) ] = 0
69+ doc ["total" ][f" { allocType } { transitionType } " ] = 0
6570
6671 for transitionType , moduleTransition in moduleTransitions .items ():
6772 for label , info in moduleTransition .items ():
@@ -84,22 +89,22 @@ def formatToCircles(moduleTransitions):
8489 max1Alloc += alloc .get ("max1Alloc" , 0 )
8590 ntransitions = moduleTransitions [transitionType ][label ]["nTransitions" ]
8691 if ntransitions > 0 :
87- modules_dict [label ]["nAlloc %s" % transitionType ] = nAlloc / ntransitions
88- modules_dict [label ]["added %s" % transitionType ] = (added / ntransitions )/ 1024
89- modules_dict [label ]["maxTemp %s" % transitionType ] = (maxTemp / ntransitions )/ 1024
90- modules_dict [label ]["nDealloc %s" % transitionType ] = nDealloc / ntransitions
91- modules_dict [label ]["max1Alloc %s" % transitionType ] = (max1Alloc / ntransitions )/ 1024
92+ modules_dict [label ][f "nAlloc { transitionType } " ] = nAlloc / ntransitions
93+ modules_dict [label ][f "added { transitionType } " ] = (added / ntransitions )/ 1024
94+ modules_dict [label ][f "maxTemp { transitionType } " ] = (maxTemp / ntransitions )/ 1024
95+ modules_dict [label ][f "nDealloc { transitionType } " ] = nDealloc / ntransitions
96+ modules_dict [label ][f "max1Alloc { transitionType } " ] = (max1Alloc / ntransitions )/ 1024
9297 else :
93- modules_dict [label ]["nAlloc %s" % transitionType ] = nAlloc
94- modules_dict [label ]["added %s" % transitionType ] = (added )/ 1024
95- modules_dict [label ]["maxTemp %s" % transitionType ] = (maxTemp )/ 1024
96- modules_dict [label ]["nDealloc %s" % transitionType ] = nDealloc
97- modules_dict [label ]["max1Alloc %s" % transitionType ] = max1Alloc / 1024
98- doc ["total" ]["nAlloc %s" % transitionType ] += modules_dict [label ]["nAlloc %s" % transitionType ]
99- doc ["total" ]["nDealloc %s" % transitionType ] += modules_dict [label ]["nDealloc %s" % transitionType ]
100- doc ["total" ]["maxTemp %s" % transitionType ] += modules_dict [label ]["maxTemp %s" % transitionType ]
101- doc ["total" ]["added %s" % transitionType ] += modules_dict [label ]["added %s" % transitionType ]
102- doc ["total" ]["max1Alloc %s" % transitionType ] += modules_dict [label ]["max1Alloc %s" % transitionType ]
98+ modules_dict [label ][f "nAlloc { transitionType } " ] = nAlloc
99+ modules_dict [label ][f "added { transitionType } " ] = (added )/ 1024
100+ modules_dict [label ][f "maxTemp { transitionType } " ] = (maxTemp )/ 1024
101+ modules_dict [label ][f "nDealloc { transitionType } " ] = nDealloc
102+ modules_dict [label ][f "max1Alloc { transitionType } " ] = max1Alloc / 1024
103+ doc ["total" ][f "nAlloc { transitionType } " ] += modules_dict [label ][f "nAlloc { transitionType } " ]
104+ doc ["total" ][f "nDealloc { transitionType } " ] += modules_dict [label ][f "nDealloc { transitionType } " ]
105+ doc ["total" ][f "maxTemp { transitionType } " ] += modules_dict [label ][f "maxTemp { transitionType } " ]
106+ doc ["total" ][f "added { transitionType } " ] += modules_dict [label ][f "added { transitionType } " ]
107+ doc ["total" ][f "max1Alloc { transitionType } " ] += modules_dict [label ][f "max1Alloc { transitionType } " ]
103108
104109 for key in sorted (modules_dict .keys ()):
105110 module = modules_dict [key ]
0 commit comments