ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DebugInfoCollector Class Reference

#include <DebugInfoCollector.h>

Inheritance diagram for DebugInfoCollector:
Collaboration diagram for DebugInfoCollector:

Public Member Functions

 DebugInfoCollector (const std::string &name="Unknown", bool byTime=true)
 
 ~DebugInfoCollector ()
 
virtual void collect (const std::string &, const std::string &) override
 
virtual std::string toString () const override
 
virtual void write () const override
 

Private Member Functions

std::string toStringByMsgKey () const
 
std::string toStringByTime () const
 

Private Attributes

std::map< std::string, std::vector< std::pair< double, std::string > > > m_info
 
std::string m_name
 
bool m_byTime
 
JetTrigTimer m_timer
 

Detailed Description

Definition at line 13 of file DebugInfoCollector.h.

Constructor & Destructor Documentation

◆ DebugInfoCollector()

DebugInfoCollector::DebugInfoCollector ( const std::string &  name = "Unknown",
bool  byTime = true 
)

Definition at line 10 of file DebugInfoCollector.cxx.

11  :
12  m_name(name),
13  m_byTime(byTime),
14  m_timer(false) // false: units are us
15 {
16  m_timer.start();
17 }

◆ ~DebugInfoCollector()

DebugInfoCollector::~DebugInfoCollector ( )

Definition at line 19 of file DebugInfoCollector.cxx.

Member Function Documentation

◆ collect()

void DebugInfoCollector::collect ( const std::string &  key,
const std::string &  info 
)
overridevirtual

Implements ITrigJetHypoInfoCollector.

Definition at line 21 of file DebugInfoCollector.cxx.

22  {
23  m_info[key].emplace_back(m_timer.elapsed_to_now(), info);
24 }

◆ toString()

std::string DebugInfoCollector::toString ( ) const
overridevirtual

Implements ITrigJetHypoInfoCollector.

Definition at line 70 of file DebugInfoCollector.cxx.

70  {
72 }

◆ toStringByMsgKey()

std::string DebugInfoCollector::toStringByMsgKey ( ) const
private

Definition at line 26 of file DebugInfoCollector.cxx.

26  {
27  /* print out messages in msg key order */
28 
29  std::stringstream ss;
30  ss << "DEBUGInfoCollector: "
31  << m_name << " no of msgs: " << m_info.size() << "\n\n";
32 
33  std::size_t msg_i {0};
34  for(const auto& i: m_info){
35  ss << "msg " << msg_i << ": " << i.first << '\n';
36  ++msg_i;
37  for(const auto& m : i.second){
38  // msg time followe by msg
39  ss << int(m.first) << " " << m.second << '\n';}
40  }
41  return ss.str();
42 }

◆ toStringByTime()

std::string DebugInfoCollector::toStringByTime ( ) const
private

Definition at line 44 of file DebugInfoCollector.cxx.

44  {
45  /* print out messages in time order */
46 
47  std::map<unsigned long, std::string> by_time;
48 
49  for(const auto& p : m_info){
50  for(const auto& tm : p.second){
51  // tm.first = time from vector of (time, msg)
52  // p.first = msg key
53  // tm.second = msg at time tm.first
54 
55  auto timestamp = static_cast<unsigned long>(tm.first);
56  by_time[timestamp] = p.first + " " + tm.second;
57  }
58  }
59 
60  std::stringstream ss;
61  ss << "DEBUGInfoCollector: "
62  << m_name << " no of msgs: " << m_info.size() << "\n\n";
63 
64  for(const auto& i: by_time){
65  ss << i.first << " " << i.second << '\n';
66  }
67  return ss.str();
68 }

◆ write()

void DebugInfoCollector::write ( ) const
overridevirtual

Implements ITrigJetHypoInfoCollector.

Definition at line 75 of file DebugInfoCollector.cxx.

75  {
76  auto report = this->toString();
77  std::ofstream out(m_name+".log");
78  out << report;
79  out.close();
80 }

Member Data Documentation

◆ m_byTime

bool DebugInfoCollector::m_byTime
private

Definition at line 33 of file DebugInfoCollector.h.

◆ m_info

std::map<std::string, std::vector<std::pair<double, std::string> > > DebugInfoCollector::m_info
private

Definition at line 31 of file DebugInfoCollector.h.

◆ m_name

std::string DebugInfoCollector::m_name
private

Definition at line 32 of file DebugInfoCollector.h.

◆ m_timer

JetTrigTimer DebugInfoCollector::m_timer
private

Definition at line 35 of file DebugInfoCollector.h.


The documentation for this class was generated from the following files:
grepfile.info
info
Definition: grepfile.py:38
DebugInfoCollector::toString
virtual std::string toString() const override
Definition: DebugInfoCollector.cxx:70
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
DebugInfoCollector::write
virtual void write() const override
Definition: DebugInfoCollector.cxx:75
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
DebugInfoCollector::m_timer
JetTrigTimer m_timer
Definition: DebugInfoCollector.h:35
DebugInfoCollector::m_info
std::map< std::string, std::vector< std::pair< double, std::string > > > m_info
Definition: DebugInfoCollector.h:31
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
checkTP.report
report
Definition: checkTP.py:127
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
DebugInfoCollector::toStringByTime
std::string toStringByTime() const
Definition: DebugInfoCollector.cxx:44
lumiFormat.i
int i
Definition: lumiFormat.py:85
JetTrigTimer::elapsed_to_now
double elapsed_to_now()
Definition: JetTrigTimer.cxx:74
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
DebugInfoCollector::toStringByMsgKey
std::string toStringByMsgKey() const
Definition: DebugInfoCollector.cxx:26
DebugInfoCollector::m_name
std::string m_name
Definition: DebugInfoCollector.h:32
JetTrigTimer::start
void start()
Definition: JetTrigTimer.cxx:15
DebugInfoCollector::m_byTime
bool m_byTime
Definition: DebugInfoCollector.h:33
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37