@@ -42,8 +42,7 @@ using namespace edm::service::monitor_file_utilities;
4242namespace {
4343
4444 using duration_t = std::chrono::microseconds;
45- using clock_t = std::chrono::steady_clock;
46- auto now = clock_t ::now;
45+ using steady_clock = std::chrono::steady_clock;
4746
4847 // ===============================================================
4948 class StallStatistics {
@@ -214,7 +213,7 @@ namespace edm {
214213 ThreadSafeOutputFileStream file_;
215214 bool const validFile_; // Separate data member from file to improve efficiency.
216215 duration_t const stallThreshold_;
217- decltype (now()) beginTime_{};
216+ decltype (steady_clock:: now()) beginTime_{};
218217
219218 // There can be multiple modules per stream. Therefore, we need
220219 // the combination of StreamID and ModuleID to correctly track
@@ -306,13 +305,13 @@ StallMonitor::StallMonitor(ParameterSet const& iPS, ActivityRegistry& iRegistry)
306305 });
307306
308307 iRegistry.preESModuleSignal_ .connect ([this ](auto const &, auto const & context) {
309- auto const t = duration_cast<duration_t >(now () - beginTime_).count ();
308+ auto const t = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
310309 auto msg = assembleMessage<step::preESModule>(
311310 numStreams_, module_id (context), std::underlying_type_t <Phase>(Phase::eventSetupCall), t);
312311 file_.write (std::move (msg));
313312 });
314313 iRegistry.postESModuleSignal_ .connect ([this ](auto const &, auto const & context) {
315- auto const t = duration_cast<duration_t >(now () - beginTime_).count ();
314+ auto const t = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
316315 auto msg = assembleMessage<step::postESModule>(
317316 numStreams_, module_id (context), std::underlying_type_t <Phase>(Phase::eventSetupCall), t);
318317 file_.write (std::move (msg));
@@ -325,7 +324,7 @@ StallMonitor::StallMonitor(ParameterSet const& iPS, ActivityRegistry& iRegistry)
325324 if (recordFrameworkTransitions) {
326325 {
327326 auto preGlobal = [this ](GlobalContext const & gc) {
328- auto const t = duration_cast<duration_t >(now () - beginTime_).count ();
327+ auto const t = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
329328 auto msg = assembleMessage<step::preFrameworkTransition>(
330329 numStreams_, gc.luminosityBlockID ().run (), gc.luminosityBlockID ().luminosityBlock (), toTransition (gc), t);
331330 file_.write (std::move (msg));
@@ -337,7 +336,7 @@ StallMonitor::StallMonitor(ParameterSet const& iPS, ActivityRegistry& iRegistry)
337336 }
338337 {
339338 auto postGlobal = [this ](GlobalContext const & gc) {
340- auto const t = duration_cast<duration_t >(now () - beginTime_).count ();
339+ auto const t = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
341340 auto msg = assembleMessage<step::postFrameworkTransition>(
342341 numStreams_, gc.luminosityBlockID ().run (), gc.luminosityBlockID ().luminosityBlock (), toTransition (gc), t);
343342 file_.write (std::move (msg));
@@ -349,7 +348,7 @@ StallMonitor::StallMonitor(ParameterSet const& iPS, ActivityRegistry& iRegistry)
349348 }
350349 {
351350 auto preStream = [this ](StreamContext const & sc) {
352- auto const t = duration_cast<duration_t >(now () - beginTime_).count ();
351+ auto const t = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
353352 auto msg = assembleMessage<step::preFrameworkTransition>(
354353 stream_id (sc), sc.eventID ().run (), sc.eventID ().luminosityBlock (), toTransition (sc), t);
355354 file_.write (std::move (msg));
@@ -361,7 +360,7 @@ StallMonitor::StallMonitor(ParameterSet const& iPS, ActivityRegistry& iRegistry)
361360 }
362361 {
363362 auto postStream = [this ](StreamContext const & sc) {
364- auto const t = duration_cast<duration_t >(now () - beginTime_).count ();
363+ auto const t = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
365364 auto msg = assembleMessage<step::postFrameworkTransition>(
366365 stream_id (sc), sc.eventID ().run (), sc.eventID ().luminosityBlock (), toTransition (sc), t);
367366 file_.write (std::move (msg));
@@ -499,23 +498,23 @@ void StallMonitor::postBeginJob() {
499498 decltype (moduleLabels_)().swap (moduleLabels_);
500499 decltype (esModuleLabels_)().swap (esModuleLabels_);
501500
502- beginTime_ = now ();
501+ beginTime_ = steady_clock:: now ();
503502}
504503
505504void StallMonitor::preSourceEvent (StreamID const sid) {
506- auto const t = duration_cast<duration_t >(now () - beginTime_).count ();
505+ auto const t = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
507506 auto msg = assembleMessage<step::preSourceEvent>(sid.value (), t);
508507 file_.write (std::move (msg));
509508}
510509
511510void StallMonitor::postSourceEvent (StreamID const sid) {
512- auto const t = duration_cast<duration_t >(now () - beginTime_).count ();
511+ auto const t = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
513512 auto msg = assembleMessage<step::postSourceEvent>(sid.value (), t);
514513 file_.write (std::move (msg));
515514}
516515
517516void StallMonitor::preEvent (StreamContext const & sc) {
518- auto const t = duration_cast<duration_t >(now () - beginTime_).count ();
517+ auto const t = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
519518 auto const & eid = sc.eventID ();
520519 auto msg = assembleMessage<step::preEvent>(stream_id (sc), eid.run (), eid.luminosityBlock (), eid.event (), t);
521520 file_.write (std::move (msg));
@@ -524,7 +523,7 @@ void StallMonitor::preEvent(StreamContext const& sc) {
524523void StallMonitor::postModuleEventPrefetching (StreamContext const & sc, ModuleCallingContext const & mcc) {
525524 auto const sid = stream_id (sc);
526525 auto const mid = module_id (mcc);
527- auto start = stallStart_[std::make_pair (sid, mid)] = std::make_pair (now (), false );
526+ auto start = stallStart_[std::make_pair (sid, mid)] = std::make_pair (steady_clock:: now (), false );
528527
529528 if (validFile_) {
530529 auto const t = duration_cast<duration_t >(start.first - beginTime_).count ();
@@ -534,7 +533,7 @@ void StallMonitor::postModuleEventPrefetching(StreamContext const& sc, ModuleCal
534533}
535534
536535void StallMonitor::preModuleEventAcquire (StreamContext const & sc, ModuleCallingContext const & mcc) {
537- auto const preModEventAcquire = now ();
536+ auto const preModEventAcquire = steady_clock:: now ();
538537 auto const sid = stream_id (sc);
539538 auto const mid = module_id (mcc);
540539 auto & start = stallStart_[std::make_pair (sid, mid)];
@@ -555,13 +554,13 @@ void StallMonitor::preModuleEventAcquire(StreamContext const& sc, ModuleCallingC
555554}
556555
557556void StallMonitor::postModuleEventAcquire (StreamContext const & sc, ModuleCallingContext const & mcc) {
558- auto const postModEventAcquire = duration_cast<duration_t >(now () - beginTime_).count ();
557+ auto const postModEventAcquire = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
559558 auto msg = assembleMessage<step::postModuleEventAcquire>(stream_id (sc), module_id (mcc), postModEventAcquire);
560559 file_.write (std::move (msg));
561560}
562561
563562void StallMonitor::preModuleEvent (StreamContext const & sc, ModuleCallingContext const & mcc) {
564- auto const preModEvent = now ();
563+ auto const preModEvent = steady_clock:: now ();
565564 auto const sid = stream_id (sc);
566565 auto const mid = module_id (mcc);
567566 auto const & start = stallStart_[std::make_pair (sid, mid)];
@@ -582,7 +581,7 @@ void StallMonitor::preModuleEvent(StreamContext const& sc, ModuleCallingContext
582581}
583582
584583void StallMonitor::preModuleStreamTransition (StreamContext const & sc, ModuleCallingContext const & mcc) {
585- auto const tNow = now ();
584+ auto const tNow = steady_clock:: now ();
586585 auto const sid = stream_id (sc);
587586 auto const mid = module_id (mcc);
588587 auto t = duration_cast<duration_t >(tNow - beginTime_).count ();
@@ -591,44 +590,44 @@ void StallMonitor::preModuleStreamTransition(StreamContext const& sc, ModuleCall
591590}
592591
593592void StallMonitor::postModuleStreamTransition (StreamContext const & sc, ModuleCallingContext const & mcc) {
594- auto const t = duration_cast<duration_t >(now () - beginTime_).count ();
593+ auto const t = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
595594 auto msg = assembleMessage<step::postModuleEvent>(stream_id (sc), module_id (mcc), toTransition (sc), t);
596595 file_.write (std::move (msg));
597596}
598597
599598void StallMonitor::preModuleGlobalTransition (GlobalContext const & gc, ModuleCallingContext const & mcc) {
600- auto t = duration_cast<duration_t >(now () - beginTime_).count ();
599+ auto t = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
601600 auto msg = assembleMessage<step::preModuleEvent>(numStreams_, module_id (mcc), toTransition (gc), t);
602601 file_.write (std::move (msg));
603602}
604603
605604void StallMonitor::postModuleGlobalTransition (GlobalContext const & gc, ModuleCallingContext const & mcc) {
606- auto const postModTime = duration_cast<duration_t >(now () - beginTime_).count ();
605+ auto const postModTime = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
607606 auto msg = assembleMessage<step::postModuleEvent>(numStreams_, module_id (mcc), toTransition (gc), postModTime);
608607 file_.write (std::move (msg));
609608}
610609
611610void StallMonitor::preEventReadFromSource (StreamContext const & sc, ModuleCallingContext const & mcc) {
612- auto const t = duration_cast<duration_t >(now () - beginTime_).count ();
611+ auto const t = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
613612 auto msg = assembleMessage<step::preEventReadFromSource>(stream_id (sc), module_id (mcc), t);
614613 file_.write (std::move (msg));
615614}
616615
617616void StallMonitor::postEventReadFromSource (StreamContext const & sc, ModuleCallingContext const & mcc) {
618- auto const t = duration_cast<duration_t >(now () - beginTime_).count ();
617+ auto const t = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
619618 auto msg = assembleMessage<step::postEventReadFromSource>(stream_id (sc), module_id (mcc), t);
620619 file_.write (std::move (msg));
621620}
622621
623622void StallMonitor::postModuleEvent (StreamContext const & sc, ModuleCallingContext const & mcc) {
624- auto const postModEvent = duration_cast<duration_t >(now () - beginTime_).count ();
623+ auto const postModEvent = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
625624 auto msg = assembleMessage<step::postModuleEvent>(
626625 stream_id (sc), module_id (mcc), static_cast <std::underlying_type_t <Phase>>(Phase::Event), postModEvent);
627626 file_.write (std::move (msg));
628627}
629628
630629void StallMonitor::postEvent (StreamContext const & sc) {
631- auto const t = duration_cast<duration_t >(now () - beginTime_).count ();
630+ auto const t = duration_cast<duration_t >(steady_clock:: now () - beginTime_).count ();
632631 auto const & eid = sc.eventID ();
633632 auto msg = assembleMessage<step::postEvent>(stream_id (sc), eid.run (), eid.luminosityBlock (), eid.event (), t);
634633 file_.write (std::move (msg));
0 commit comments