39 std::unique_ptr<std::atomic<std::chrono::high_resolution_clock::rep>[]>
m_timeSums;
42 std::chrono::high_resolution_clock::time_point
m_time;
140 iReg.watchPreSourceEvent([
this](
StreamID){
143 m_startedTiming=
true;
150 iReg.watchPostSourceEvent([
this](
StreamID){
158 std::cout <<
"Fraction of time running n Modules simultaneously"<<std::endl;
189 std::chrono::high_resolution_clock::time_point oldTime;
190 bool expected =
false;
191 unsigned int nModules;
192 while (not
m_spinLock.compare_exchange_strong(expected,
true,std::memory_order_acq_rel)){
199 m_spinLock.store(
false,std::memory_order_release);
202 auto diff = newTime - oldTime;
203 for(
unsigned int i=0;
i<nModules;++
i) {
212 std::chrono::high_resolution_clock::time_point oldTime;
213 bool expected =
false;
214 unsigned int nModules;
215 while (not
m_spinLock.compare_exchange_weak(expected,
true,std::memory_order_acq_rel)){
222 m_spinLock.store(
false,std::memory_order_release);
225 auto diff = newTime - oldTime;
226 for(
unsigned int i=0;
i<=nModules;++
i) {
253 desc.
addUntracked<std::vector<std::string> >(
"modulesToExclude", std::vector<std::string>{})->setComment(
"Module labels to exclude from the timing measurements");
254 desc.
addUntracked<
bool>(
"excludeSource",
false)->setComment(
"Exclude the time the source is running");
255 descriptions.
add(
"ConcurrentModuleTimer", desc);
unsigned int maxNumberOfThreads() const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ConcurrentModuleTimer(edm::ParameterSet const &iConfig, edm::ActivityRegistry &iAR)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::string const & moduleLabel() const
std::vector< std::string > m_modulesToExclude
std::chrono::high_resolution_clock::time_point m_time
ModuleDescription const * moduleDescription() const
#define DEFINE_FWK_SERVICE(type)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< unsigned int > m_excludedModuleIds
std::atomic< bool > m_spinLock
bool trackModule(ModuleCallingContext const &iContext) const
std::unique_ptr< std::atomic< std::chrono::high_resolution_clock::rep >[]> m_timeSums