Skip to content
Snippets Groups Projects
Commit 1eba0b80 authored by amete's avatar amete
Browse files

Starting groundwork for PerfMon MT migration

parent 4cbd9907
9 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!28528Revert 63f845ae,!27054Atr20369 210,!26342Monopole: Handle fractionally charged particles,!24043Adding baseline code for PerfMonMT GSoC work
Showing
with 410 additions and 0 deletions
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PERFMONCOMPS_PERFMONMTALG_H
#define PERFMONCOMPS_PERFMONMTALG_H
// Framework includes
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
// Forward declaration
class IPerfMonMTSvc;
class PerfMonMTAlg : public AthReentrantAlgorithm {
public:
/// Standard Algorithm constructor
PerfMonMTAlg( const std::string& name, ISvcLocator* pSvcLocator );
/// Standard initialization function
StatusCode initialize();
/// Standard execute function
StatusCode execute( const EventContext& ) const;
/// Standard finalization function
StatusCode finalize();
private:
/// Handle to PerfMonMTSvc
ServiceHandle< IPerfMonMTSvc > m_perfMonMTSvc;
};
#endif // PERFMONCOMPS_PERFMONMTALG_H
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PERFMONCOMPS_PERFMONMTAUDITOR_H
#define PERFMONCOMPS_PERFMONMTAUDITOR_H
// STL includes
#include <string>
// Framework includes
#include "GaudiKernel/Auditor.h"
#include "GaudiKernel/ServiceHandle.h"
// Forward declaration
//class INamedInterface;
class IPerfMonMTSvc;
class PerfMonMTAuditor : public Auditor
{
/*
using Auditor::before;
using Auditor::after;
*/
public:
/// Constructor
PerfMonMTAuditor(const std::string& name, ISvcLocator* pSvcLocator);
/// Gaudi hooks
virtual StatusCode initialize() override;
/// Implement inherited methods from Auditor
void before( StandardEventType, INamedInterface* ) override;
void before( StandardEventType, const std::string& ) override;
void before( CustomEventTypeRef, INamedInterface* ) override;
void before( CustomEventTypeRef, const std::string& ) override;
void after( StandardEventType, INamedInterface*, const StatusCode& ) override;
void after( StandardEventType, const std::string&, const StatusCode& ) override;
void after( CustomEventTypeRef, INamedInterface*, const StatusCode& ) override;
void after( CustomEventTypeRef, const std::string&, const StatusCode& ) override;
private:
/// Handle to PerfMonMTSvc
ServiceHandle< IPerfMonMTSvc > m_perfMonMTSvc;
}; // end PerfMonMTAuditor
#endif // PERFMONCOMPS_PERFMONMTAUDITOR_H
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PERFMONCOMPS_PERFMONMTSVC_H
#define PERFMONCOMPS_PERFMONMTSVC_H
#include "AthenaBaseComps/AthService.h"
#include "PerfMonKernel/IPerfMonMTSvc.h"
class PerfMonMTSvc : virtual public IPerfMonMTSvc,
public AthService
{
public:
/// Standard Gaudi Service constructor
PerfMonMTSvc( const std::string& name, ISvcLocator* pSvcLocator );
/// Function declaring the interface(s) implemented by the service
virtual StatusCode queryInterface( const InterfaceID& riid,
void** ppvInterface ) override;
/// Standard Gaudi Service initialization
virtual StatusCode initialize() override;
/// Standard Gaudi Service finalization
virtual StatusCode finalize() override;
/// Start Auditing
virtual void startAud( const std::string& stepName,
const std::string& compName ) override;
/// Stop Auditing
virtual void stopAud ( const std::string& stepName,
const std::string& compName ) override;
}; // class PerfMonMTSvc
#endif // PERFMONCOMPS_PERFMONMTSVC_H
###############################
# Load PerfMonMTSvc
###############################
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
if not hasattr(svcMgr, "PerfMonMTSvc"):
from PerfMonComps.PerfMonCompsConf import PerfMonMTSvc
svcMgr += PerfMonMTSvc("PerfMonMTSvc")
pass
###############################
# Load PerfMonMTAlg
###############################
from AthenaCommon.AlgSequence import AthSequencer
topSequence = AthSequencer("AthAlgSeq")
if not hasattr(topSequence, "PerfMonMTSvcAlg"):
from PerfMonComps.PerfMonCompsConf import PerfMonMTAlg
topSequence += PerfMonMTAlg("PerfMonMTAlg")
pass
###############################
# Print what we did
###############################
from AthenaCommon.Logging import logging
log = logging.getLogger("PerfMonMTSvc_jobOptions.py")
log.info("Setting up PerfMonMT...")
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// PerfMonKernel includes
#include "PerfMonKernel/IPerfMonMTSvc.h"
// PerfMonComps includes
#include "PerfMonComps/PerfMonMTAlg.h"
/*
* Constructor
*/
PerfMonMTAlg::PerfMonMTAlg( const std::string& name,
ISvcLocator* pSvcLocator )
: AthReentrantAlgorithm( name, pSvcLocator ),
m_perfMonMTSvc( "PerfMonMTSvc", name ) {
}
/*
* Initialize the algorithm
*/
StatusCode PerfMonMTAlg::initialize() {
ATH_MSG_INFO("Initialize");
/// Retrieve the PerfMonMTSvc
CHECK( m_perfMonMTSvc.retrieve() );
return StatusCode::SUCCESS;
}
/*
* Finalize the algorithm
*/
StatusCode PerfMonMTAlg::finalize() {
ATH_MSG_INFO("Finalize");
return StatusCode::SUCCESS;
}
/*
* Execute the algorithm
*/
StatusCode PerfMonMTAlg::execute( const EventContext& /*ctx*/ ) const {
// Call startAud
m_perfMonMTSvc->startAud("","");
return StatusCode::SUCCESS;
}
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// Framework includes
#include "GaudiKernel/INamedInterface.h"
// PerfMonKernel includes
#include "PerfMonKernel/IPerfMonMTSvc.h"
// PerfMonComps includes
#include "PerfMonComps/PerfMonMTAuditor.h"
/*
* Constructor
*/
PerfMonMTAuditor::PerfMonMTAuditor( const std::string& name,
ISvcLocator* pSvcLocator ) :
Auditor ( name, pSvcLocator ),
m_perfMonMTSvc ( "PerfMonMTSvc", name )
{
}
/*
* Initialize the Auditor
*/
StatusCode PerfMonMTAuditor::initialize()
{
//ATH_MSG_INFO("Initialize");
if ( !m_perfMonMTSvc.retrieve().isSuccess() ) {
//ATH_MSG_ERROR("Could not retrieve PerfMonMTSvc!");
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
/*
* Implementation of base class methods
*/
void PerfMonMTAuditor::before( StandardEventType, INamedInterface* ) { return; }
void PerfMonMTAuditor::before( StandardEventType, const std::string& ) { return; }
void PerfMonMTAuditor::before( CustomEventTypeRef, INamedInterface* ) { return; }
void PerfMonMTAuditor::before( CustomEventTypeRef, const std::string& ) { return; }
void PerfMonMTAuditor::after( StandardEventType, INamedInterface*, const StatusCode& ) { return; }
void PerfMonMTAuditor::after( StandardEventType, const std::string&, const StatusCode& ) { return; }
void PerfMonMTAuditor::after( CustomEventTypeRef, INamedInterface*, const StatusCode& ) { return; }
void PerfMonMTAuditor::after( CustomEventTypeRef, const std::string&, const StatusCode& ) { return; }
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
// STL includes
#include <pthread.h>
#include <time.h>
// Framework includes
#include "GaudiKernel/ThreadLocalContext.h"
// PerfMonComps includes
#include "PerfMonComps/PerfMonMTSvc.h"
#include "PerfMonUtils.h" // borrow from existing code
/*
* Constructor
*/
PerfMonMTSvc::PerfMonMTSvc( const std::string& name,
ISvcLocator* pSvcLocator )
: AthService( name, pSvcLocator ) {
}
/*
* Query Interface
*/
StatusCode PerfMonMTSvc::queryInterface( const InterfaceID& riid,
void** ppvInterface ) {
if( !ppvInterface ) {
return StatusCode::FAILURE;
}
if ( riid == IPerfMonMTSvc::interfaceID() ) {
*ppvInterface = static_cast< IPerfMonMTSvc* >( this );
return StatusCode::SUCCESS;
}
return AthService::queryInterface( riid, ppvInterface );
}
/*
* Initialize the Service
*/
StatusCode PerfMonMTSvc::initialize() {
ATH_MSG_INFO("Initialize");
/// Configure the auditor
if( !PerfMon::makeAuditor("PerfMonMTAuditor", auditorSvc(), msg()).isSuccess()) {
ATH_MSG_ERROR("Could not register auditor [PerfMonMTAuditor]!");
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
/*
* Finalize the Service
*/
StatusCode PerfMonMTSvc::finalize() {
ATH_MSG_INFO("Finalize");
return StatusCode::SUCCESS;
}
/*
* Start Auditing
*/
void PerfMonMTSvc::startAud( const std::string& /*stepName*/,
const std::string& /*compName*/ ) {
ATH_MSG_INFO("Starting Auditing");
const EventContext ctx = Gaudi::Hive::currentContext();
if(ctx.valid()) {
ATH_MSG_INFO("Current event number is " << ctx.evt() <<
" slot number is " << ctx.slot());
}
// Get thread's clock id
clockid_t thread_cid;
pthread_getcpuclockid(pthread_self(),&thread_cid);
ATH_MSG_INFO("Current threads' CPU clock id is " << thread_cid);
}
/*
* Stop Auditing
*/
void PerfMonMTSvc::stopAud( const std::string& /*stepName*/,
const std::string& /*compName*/ ) {
ATH_MSG_INFO("Stopping Auditing");
}
......@@ -32,6 +32,11 @@ StatusCode
makeAuditor( const std::string& audName, IAuditorSvc* audSvc,
MsgStream& msg )
{
msg << MSG::INFO << "SERHAN" << endmsg;
msg << MSG::INFO << "SERHAN" << endmsg;
msg << MSG::INFO << "SERHAN" << endmsg;
msg << MSG::INFO << "SERHAN" << endmsg;
if ( 0 == audSvc ) {
msg << MSG::ERROR << "Null pointer to IAuditorSvc !!" << endmsg;
return StatusCode::FAILURE;
......
......@@ -5,6 +5,8 @@
#include "../PerfMonAuditor.h"
#include "../PerfMonStorePayloadMon.h"
#include "PerfMonComps/PerfMonMTSvc.h"
#include "PerfMonComps/PerfMonMTAlg.h"
DECLARE_COMPONENT( PerfMonSvc )
DECLARE_COMPONENT( Athena::PerfMonAuditor )
......@@ -14,3 +16,5 @@ DECLARE_COMPONENT( PerfMon::CallGraphBuilderSvc )
DECLARE_COMPONENT( PerfMon::CallGraphAuditor )
DECLARE_COMPONENT( PerfMon::StorePayloadMon )
DECLARE_COMPONENT( PerfMonMTSvc )
DECLARE_COMPONENT( PerfMonMTAlg )
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PERMONKERNEL_IPERFMONMTSV_H
#define PERMONKERNEL_IPERFMONMTSV_H
/// STL includes
#include <string>
/// Framework include
//#include "GaudiKernel/IMonitorSvc.h"
#include "GaudiKernel/IService.h"
//class IPerfMonMTSvc : virtual public IMonitorSvc
class IPerfMonMTSvc : virtual public IService
{
public:
/// Framework - Service InterfaceID
static const InterfaceID& interfaceID();
/// Start Auditing
virtual void startAud( const std::string& stepName,
const std::string& compName = "PerfMonMTSlice" ) = 0;
/// Stop Auditing
virtual void stopAud( const std::string& stepName,
const std::string& compName = "PerfMonMTSlice" ) = 0;
}; // class IPerfMonMTSvc
///////////////////////////////////////////////////////////////////
// Inline methods:
///////////////////////////////////////////////////////////////////
inline const InterfaceID& IPerfMonMTSvc::interfaceID()
{
static const InterfaceID IID_IPerfMonMTSvc("IPerfMonMTSvc", 1, 0);
return IID_IPerfMonMTSvc;
}
#endif // PERMONKERNEL_IPERFMONMTSV_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment