LDMX Software
Callback.cxx
1
2#include "Framework/Performance/Callback.h"
3
4#include "Framework/Exception/Exception.h"
5
6namespace framework::performance {
7
8std::string to_name(Callback c) {
9 switch (c) {
10 case Callback::onProcessStart:
11 return "onProcessStart";
12 case Callback::onProcessEnd:
13 return "onProcessEnd";
14 case Callback::onFileOpen:
15 return "onFileOpen";
16 case Callback::onFileClose:
17 return "onFileClose";
18 case Callback::beforeNewRun:
19 return "beforeNewRun";
20 case Callback::onNewRun:
21 return "onNewRun";
22 case Callback::process:
23 return "process";
24 }
25 EXCEPTION_RAISE(
26 "BadCode",
27 "Somehow we got a Callback enum (value: " + std::to_string(to_index(c)) +
28 ") that doesn't match one of the listed possibilities\n"
29 "Did a new Callback get added to the performance tracker and the "
30 "to_name function wasn't updated?");
31}
32
33} // namespace framework::performance