Commit 461e1454 authored by Ruggero Turra's avatar Ruggero Turra 🎧
Browse files

last try

parent eb327446
......@@ -6,6 +6,7 @@ import ROOT
import os
import psutil
import time
import gc
__doc__ = "To print the vmem usage before and after instantiating egammaMVACalibTool"
......@@ -55,22 +56,24 @@ if __name__ == "__main__":
'unconverted') if args.particle_type == 'all' else (args.particle_type,)
print(
"Particle Folder Initial [GB] After constr. [GB] After init. [GB]")
"Particle Folder Initial [MB] After constr. [MB] After init. [MB]")
# this dummy tool is to force the loading of all the shared libraries and other resources
# which should not be counted in the memory usage
dummy_tool = create_tool(convert_particle_type(
particle_types_str[0]), args.folder)
dummy_tool.initialize()
gc.disable()
for particle_type in particle_types_str:
memory_initial = Vmem() / 1E9 # in GB
memory_initial = Vmem() / 1E6 # in MB
tool = create_tool(
convert_particle_type(particle_type), args.folder)
memory_after_constructor = Vmem() / 1E9
memory_after_constructor = Vmem() / 1E6
tool.initialize()
memory_final = Vmem() / 1E9
memory_final = Vmem() / 1E6
print("{:<15s} {:35s} {:13.2f} {:10.2f} (+{:2.3f}) {:8.2f} (+{:2.3f})".format(
print("{:<15s} {:35s} {:13.0f} {:11.0f} ({:+5.0f}) {:9.0f} ({:+5.0f})".format(
particle_type, args.folder, memory_initial,
memory_after_constructor, memory_after_constructor - memory_initial,
memory_final, memory_final - memory_after_constructor))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment