39 std::unique_ptr<std::atomic<std::chrono::high_resolution_clock::rep>[]>
m_timeSums;
42 std::chrono::high_resolution_clock::time_point
m_time;
135 iReg.watchPreSourceEvent([
this](
StreamID) {
138 m_startedTiming =
true;
145 iReg.watchPostSourceEvent([
this](
StreamID) {
stop(); });
150 std::cout <<
"Fraction of time running n Modules simultaneously" << std::endl;
178 std::chrono::high_resolution_clock::time_point oldTime;
179 bool expected =
false;
180 unsigned int nModules;
181 while (not
m_spinLock.compare_exchange_strong(expected,
true, std::memory_order_acq_rel)) {
188 m_spinLock.store(
false, std::memory_order_release);
191 auto diff = newTime - oldTime;
192 for (
unsigned int i = 0;
i < nModules; ++
i) {
199 std::chrono::high_resolution_clock::time_point oldTime;
200 bool expected =
false;
201 unsigned int nModules;
202 while (not
m_spinLock.compare_exchange_weak(expected,
true, std::memory_order_acq_rel)) {
209 m_spinLock.store(
false, std::memory_order_release);
212 auto diff = newTime - oldTime;
213 for (
unsigned int i = 0;
i <= nModules; ++
i) {
236 desc.
addUntracked<std::vector<std::string>>(
"modulesToExclude", std::vector<std::string>{})
237 ->setComment(
"Module labels to exclude from the timing measurements");
238 desc.
addUntracked<
bool>(
"excludeSource",
false)->setComment(
"Exclude the time the source is running");
239 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