1. 1. How to use
  2. Add the following lines at the top of your macro. This will
  3. fork a process which will measure the memory used by executing
  4. the macro. The variable Interval defines the time between two
  5. measurements in seconds. Choose this Interval between two
  6. measurements according to your needs.
  7. Int_t Interval=10;
  8. Int_t PID=gSystem->GetPid();
  9. cout<<"PID: "<<PID<<endl;
  10. TString cmdline="$VMCWORKDIR/scripts/ ";
  11. cmdline+= PID;
  12. cmdline+= " ";
  13. cmdline+= Interval;
  14. cmdline+= " &";
  15. cout<<cmdline<<endl;
  16. gSystem->Exec(cmdline);
  17. After you add the lines run the macro as normal.
  18. After the macro finished you will have a file memory_consumption_<pid>.txt
  19. which contains rows with a timestamp and the relevant information.
  20. This file can be used to plot the memory consumption as a function of time.
  21. 2. How to display the data taken with
  22. Run the root macro Read_Memory_File.C with the following parameters. The
  23. first parameter is the name of the file created with .
  24. The second parameter is the time Interval between two measurements. It is
  25. planed to extract this information from the time string stored in the text
  26. file.
  27. The macro converts the ascii input to a ntuple which is stored in a root
  28. file with the same name as the input file but the extension .root.