From 144fcde21b3210fe4d732124f2cac8adbb036750 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Tue, 13 Feb 2018 13:17:05 +0100
Subject: [PATCH] ddsim: print start up and time per event

---
 DDSim/DD4hepSimulation.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/DDSim/DD4hepSimulation.py b/DDSim/DD4hepSimulation.py
index 877d7747c..44c0b3745 100644
--- a/DDSim/DD4hepSimulation.py
+++ b/DDSim/DD4hepSimulation.py
@@ -492,12 +492,18 @@ class DD4hepSimulation(object):
 
     #DDG4.setPrintLevel(Output.DEBUG)
 
+    startUpTime, _sysTime, _cuTime, _csTime, _elapsedTime = os.times()
+
     kernel.run()
     kernel.terminate()
 
-    userTime, sysTime,_cuTime, _csTime, _elapsedTime = os.times()
+    totalTimeUser, totalTimeSys, _cuTime, _csTime, _elapsedTime = os.times()
     if self.printLevel <= 3:
-      print "DDSim            INFO  Execution Time: %3.2f s (User), %3.2f s (System)"% (userTime, sysTime)
+      eventTime = totalTimeUser - startUpTime
+      perEventTime =  eventTime / float(self.numberOfEvents)
+      print "DDSim            INFO  Total Time:   %3.2f s (User), %3.2f s (System)"% (totalTimeUser, totalTimeSys)
+      print "DDSim            INFO  StartUp Time: %3.2f s, Event Processing: %3.2f s (%3.2f s/Event) " \
+        % (startUpTime, eventTime, perEventTime)
 
 
   def __setMagneticFieldOptions(self, simple):
-- 
GitLab