The Gaudi Framework  master (37c0b60a)
ReEntAlg.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #include "ReEntAlg.h"
13 #include <GaudiKernel/MsgStream.h>
14 
15 #include <chrono>
16 #include <thread>
17 
19 
20 
22 ReEntAlg::ReEntAlg( const std::string& name, ISvcLocator* pSvcLocator ) : Gaudi::Algorithm( name, pSvcLocator ) {}
23 
24 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
25 
27  auto sc = Gaudi::Algorithm::initialize();
28  if ( !sc ) return sc;
29  info() << "initialize()" << endmsg;
30  return sc;
31 }
32 
33 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
34 
36  // wait a little bit to make sure the printouts are in a stable order
38 
39  info() << "execute(): context: (" << ctx << ") index: " << index() << " cardinality: " << cardinality() << endmsg;
40 
41  std::chrono::milliseconds dt{ m_sleep + ctx.slot() * 500 };
43 
44  info() << "... done in " << dt.count() << " ms for " << ctx << endmsg;
46 
47  return StatusCode::SUCCESS;
48 }
49 
50 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
51 
53  info() << "finalize()" << endmsg;
55 }
std::this_thread::sleep_for
T sleep_for(T... args)
Gaudi::Algorithm::index
unsigned int index() const override
Definition: Algorithm.cpp:532
ISvcLocator
Definition: ISvcLocator.h:46
Gaudi::Algorithm::initialize
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition: Algorithm.h:178
Algorithm
Alias for backward compatibility.
Definition: Algorithm.h:58
std::chrono::milliseconds
ReEntAlg::m_sleep
Gaudi::Property< unsigned int > m_sleep
Definition: ReEntAlg.h:29
Gaudi::Algorithm::cardinality
unsigned int cardinality() const override
Return the cardinality.
Definition: Algorithm.h:415
ReEntAlg.h
ReEntAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition: ReEntAlg.cpp:35
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:578
StatusCode
Definition: StatusCode.h:65
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
Gaudi::Algorithm::finalize
StatusCode finalize() override
the default (empty) implementation of IStateful::finalize() method
Definition: Algorithm.h:184
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
ReEntAlg::finalize
StatusCode finalize() override
Definition: ReEntAlg.cpp:52
std
STL namespace.
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
ReEntAlg::initialize
StatusCode initialize() override
Definition: ReEntAlg.cpp:26
ReEntAlg
Definition: ReEntAlg.py:1
EventContext
Definition: EventContext.h:34
ISvcLocator.h
MsgStream.h