LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
writeSummary.cc
Go to the documentation of this file.
2 
5 #include "cetlib/container_algorithms.h"
6 #include "cetlib/cpu_timer.h"
8 
9 #include <iomanip>
10 
11 using mf::LogPrint;
12 using std::fixed;
13 using std::right;
14 using std::setprecision;
15 using std::setw;
16 
17 namespace {
18 
19  void
20  workersInPathTriggerReport(int const firstBit,
21  int const bitPosition,
22  art::Path::WorkersInPath const& workersInPath)
23  {
24  for (auto const& workerInPath : workersInPath) {
25  LogPrint("ArtSummary")
26  << "TrigReport " << right << setw(5) << firstBit << right << setw(5)
27  << bitPosition << " " << right << setw(10)
28  << workerInPath.timesVisited() << " " << right << setw(10)
29  << workerInPath.timesPassed() << " " << right << setw(10)
30  << workerInPath.timesFailed() << " " << right << setw(10)
31  << workerInPath.timesExcept() << " "
32  << workerInPath.getWorker()->description().moduleLabel();
33  }
34  }
35 
36  void
37  workersInEndPathTriggerReport(int const firstBit,
38  int const bitPosition,
39  art::Path::WorkersInPath const& workersInPath)
40  {
41  for (auto const& workerInPath : workersInPath) {
42  auto worker = workerInPath.getWorker();
43  LogPrint("ArtSummary")
44  << "TrigReport " << right << setw(5) << firstBit << right << setw(5)
45  << bitPosition << " " << right << setw(10) << worker->timesRun()
46  << " " // proxy for visited
47  << right << setw(10) << worker->timesPassed() << " " << right
48  << setw(10) << worker->timesExcept() << " "
49  << worker->description().moduleLabel();
50  }
51  }
52 }
53 
54 void
56  bool const wantSummary,
57  cet::cpu_timer const& jobTimer)
58 {
59  // Still only assuming one schedule. Will need to loop when we get around to
60  // it.
61  auto const& epi = pm.endPathInfo();
62  auto const& tpi = pm.triggerPathsInfo(ScheduleID::first());
63  LogPrint("ArtSummary") << "";
64  triggerReport(epi, tpi, wantSummary);
65  LogPrint("ArtSummary") << "";
66  timeReport(jobTimer);
67  LogPrint("ArtSummary") << "";
68  memoryReport();
69 }
70 
71 void
73  PathsInfo const& tpi,
74  bool const wantSummary)
75 {
76  // The trigger report (pass/fail etc.):
77  // Printed even if summary not requested, per issue #1864.
78  LogPrint("ArtSummary") << "TrigReport "
79  << "---------- Event Summary ------------";
80  LogPrint("ArtSummary") << "TrigReport"
81  << " Events total = " << tpi.totalEvents()
82  << " passed = " << tpi.passedEvents()
83  << " failed = " << tpi.failedEvents();
84  if (wantSummary) {
85  LogPrint("ArtSummary") << "";
86  LogPrint("ArtSummary") << "TrigReport "
87  << "---------- Path Summary ------------";
88  LogPrint("ArtSummary") << "TrigReport " << right << setw(10) << "Trig Bit#"
89  << " " << right << setw(10) << "Run"
90  << " " << right << setw(10) << "Passed"
91  << " " << right << setw(10) << "Failed"
92  << " " << right << setw(10) << "Error"
93  << " "
94  << "Name";
95  for (auto const& path : tpi.pathPtrs()) {
96  LogPrint("ArtSummary")
97  << "TrigReport " << right << setw(5) << 1 << right << setw(5)
98  << path->bitPosition() << " " << right << setw(10) << path->timesRun()
99  << " " << right << setw(10) << path->timesPassed() << " " << right
100  << setw(10) << path->timesFailed() << " " << right << setw(10)
101  << path->timesExcept() << " " << path->name();
102  }
103  LogPrint("ArtSummary") << "";
104  LogPrint("ArtSummary") << "TrigReport "
105  << "-------End-Path Summary ------------";
106  LogPrint("ArtSummary") << "TrigReport " << right << setw(10) << "Trig Bit#"
107  << " " << right << setw(10) << "Run"
108  << " " << right << setw(10) << "Success"
109  << " " << right << setw(10) << "Error"
110  << " "
111  << "Name";
112  for (auto const& path : epi.pathPtrs()) {
113  LogPrint("ArtSummary")
114  << "TrigReport " << right << setw(5) << 0 << right << setw(5)
115  << path->bitPosition() << " " << right << setw(10) << path->timesRun()
116  << " " << right << setw(10) << path->timesPassed() << " " << right
117  << setw(10) << path->timesExcept() << " " << path->name();
118  }
119  for (auto const& path : tpi.pathPtrs()) {
120  LogPrint("ArtSummary") << "";
121  LogPrint("ArtSummary")
122  << "TrigReport "
123  << "---------- Modules in Path: " << path->name() << " ------------";
124  LogPrint("ArtSummary")
125  << "TrigReport " << right << setw(10) << "Trig Bit#"
126  << " " << right << setw(10) << "Visited"
127  << " " << right << setw(10) << "Passed"
128  << " " << right << setw(10) << "Failed"
129  << " " << right << setw(10) << "Error"
130  << " "
131  << "Name";
132  workersInPathTriggerReport(1, path->bitPosition(), path->workersInPath());
133  }
134  }
135 
136  // Printed even if summary not requested, per issue #1864.
137  for (auto const& path : epi.pathPtrs()) {
138  LogPrint("ArtSummary") << "";
139  LogPrint("ArtSummary") << "TrigReport "
140  << "------ Modules in End-Path: " << path->name()
141  << " ------------";
142  LogPrint("ArtSummary") << "TrigReport " << right << setw(10) << "Trig Bit#"
143  << " " << right << setw(10) << "Run"
144  << " " << right << setw(10) << "Success"
145  << " " << right << setw(10) << "Error"
146  << " "
147  << "Name";
148  workersInEndPathTriggerReport(
149  0, path->bitPosition(), path->workersInPath());
150  }
151 
152  if (wantSummary) {
153  // This table can arguably be removed since all summary
154  // information is better described aboved.
155  LogPrint("ArtSummary") << "";
156  LogPrint("ArtSummary") << "TrigReport "
157  << "---------- Module Summary ------------";
158  LogPrint("ArtSummary") << "TrigReport " << right << setw(10) << "Visited"
159  << " " << right << setw(10) << "Run"
160  << " " << right << setw(10) << "Passed"
161  << " " << right << setw(10) << "Failed"
162  << " " << right << setw(10) << "Error"
163  << " "
164  << "Name";
165 
166  for (auto const& val : tpi.workers()) {
167  LogPrint("ArtSummary")
168  << "TrigReport " << right << setw(10) << val.second->timesVisited()
169  << " " << right << setw(10) << val.second->timesRun() << " " << right
170  << setw(10) << val.second->timesPassed() << " " << right << setw(10)
171  << val.second->timesFailed() << " " << right << setw(10)
172  << val.second->timesExcept() << " " << val.first;
173  }
174 
175  for (auto const& val : epi.workers()) {
176  // Instead of timesVisited(), which is confusing for the user
177  // for end-path modules, we just report timesRun() as a proxy
178  // for visited.
179  LogPrint("ArtSummary")
180  << "TrigReport " << right << setw(10) << val.second->timesVisited()
181  << " " << right << setw(10) << val.second->timesRun() << " " << right
182  << setw(10) << val.second->timesPassed() << " " << right << setw(10)
183  << val.second->timesFailed() << " " << right << setw(10)
184  << val.second->timesExcept() << " " << val.first;
185  }
186  }
187 }
188 
189 void
190 art::detail::timeReport(cet::cpu_timer const& timer)
191 {
192  LogPrint("ArtSummary") << "TimeReport "
193  << "---------- Time Summary ---[sec]----";
194  LogPrint("ArtSummary") << "TimeReport " << setprecision(6) << fixed
195  << "CPU = " << timer.cpuTime()
196  << " Real = " << timer.realTime();
197 }
void triggerReport(PathsInfo const &endPathsInfo, PathsInfo const &triggerPathsInfo, bool wantSummary)
Definition: writeSummary.cc:72
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:112
size_t passedEvents() const
Definition: PathsInfo.h:93
size_t failedEvents() const
Definition: PathsInfo.h:99
std::vector< WorkerInPath > WorkersInPath
Definition: Path.h:36
WorkerMap const & workers() const
Definition: PathsInfo.h:81
void writeSummary(PathManager &pm, bool wantSummary, cet::cpu_timer const &timer)
Definition: writeSummary.cc:55
size_t totalEvents() const
Definition: PathsInfo.h:105
PathsInfo & endPathInfo()
Definition: PathManager.cc:132
PathsInfo & triggerPathsInfo(ScheduleID sID)
Definition: PathManager.cc:143
void timeReport(cet::cpu_timer const &timer)
PathPtrs const & pathPtrs() const
Definition: PathsInfo.h:87
MaybeLogger_< ELseverityLevel::ELsev_warning, true > LogPrint