From 8e9ad38778ad43f5a2cfeeb77fd785694a11c1aa Mon Sep 17 00:00:00 2001
From: Alex Pearce <alex.pearce@cern.ch>
Date: Wed, 14 Jun 2017 18:18:22 +0200
Subject: [PATCH] Enable the algorithm timing table.

Method taken from  DaVinci's Configuration.py:

    https://gitlab.cern.ch/lhcb/DaVinci/blob/77d3e66ed062777c73e5071fe5eb8e68d889c220/Phys/DaVinci/python/DaVinci/Configuration.py#L305-328
---
 Phys/Tesla/python/Tesla/Configuration.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/Phys/Tesla/python/Tesla/Configuration.py b/Phys/Tesla/python/Tesla/Configuration.py
index 729b8841e..80935bd92 100644
--- a/Phys/Tesla/python/Tesla/Configuration.py
+++ b/Phys/Tesla/python/Tesla/Configuration.py
@@ -4,6 +4,7 @@ import re
 
 from Configurables import (
     AddressKillerAlg,
+    AuditorSvc,
     CaloClusterMCTruth,
     CaloDigit2MCLinks2Table,
     ChargedPP2MC,
@@ -38,9 +39,11 @@ from Configurables import (
     RecSummaryFromSelReports,
     RecombineRawEvent,
     RecordStream,
+    SequencerTimerTool,
     TCKLinePersistenceSvc,
     TeslaLineChecker,
     TeslaReportAlgo,
+    TimingAuditor,
     TrackAssociator,
     TrackSys,
     TurboConf,
@@ -189,6 +192,17 @@ class Tesla(LHCbConfigurableUser):
         if ( self.getProp("Histogram") != "" ):
             HistogramPersistencySvc().OutputFile = self.getProp("Histogram")
 
+    def _configureTimingAuditor(self):
+        """Enable the printing of the algorithm timing table."""
+        ApplicationMgr().ExtSvc += ['ToolSvc', 'AuditorSvc']
+        ApplicationMgr().AuditAlgorithms = True
+        AuditorSvc().Auditors += ['TimingAuditor']
+
+        TimingAuditor().addTool(SequencerTimerTool, name='TIMER')
+        TimingAuditor().TIMER.NameSize = 60
+        # Disable INFO output from the default timer tool
+        SequencerTimerTool().OutputLevel = WARNING
+
     def _configureTrackTruth(self,assocpp,trackLoc) :
         assoctr = TrackAssociator("TurboAssocTr"+trackLoc)
         assoctr.OutputLevel = self.getProp('OutputLevel')
@@ -1039,6 +1053,9 @@ class Tesla(LHCbConfigurableUser):
         if len(self.getProp('Monitors'))>0:
             self._configureHistos()
 
+        # Enable the timing table
+        self._configureTimingAuditor()
+
         if self.getProp('KillInputTurbo'):
             enk = EventNodeKiller('KillTurbo')
             enk.Nodes = [ "Turbo" ]
-- 
GitLab