Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-22 02:23:50

0001 import json
0002 
0003 input_file = 'Phase2Timing_resources.json'
0004 output_file = 'Phase2Timing_resources_abs.json'
0005 
0006 orig = json.load(open(input_file,'r'))
0007 
0008 time_real_abs = 0.
0009 time_thread_abs = 0.
0010 
0011 events = orig['total']['events']
0012 orig['resources'].append({'time_real_abs': 'real time abs'})
0013 orig['resources'].append({'time_thread_abs': 'cpu time abs'})
0014 
0015 for k in orig['modules']:
0016     if k['events'] > 0:
0017         if k['label'] != "other":
0018             k['time_real_abs'] = k['time_real']/k['events']*events
0019             k['time_thread_abs'] = k['time_thread']/k['events']*events
0020         else:
0021             k['time_real_abs'] = k['time_real']
0022             k['time_thread_abs'] = k['time_thread']
0023         time_real_abs += k['time_real']
0024         time_thread_abs += k['time_thread']
0025     else:
0026         k['time_real_abs'] = 0
0027         k['time_thread_abs'] = 0
0028 
0029 orig['total']['time_real_abs'] = time_real_abs
0030 orig['total']['time_thread_abs'] = time_thread_abs
0031 
0032 json.dump(orig, open(output_file, 'w'), indent=2)
0033