gem5  v22.1.0.0
report.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Google, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer;
8  * redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution;
11  * neither the name of the copyright holders nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef __SYSTEMC_UTILS_REPORT_HH__
29 #define __SYSTEMC_UTILS_REPORT_HH__
30 
31 #include <initializer_list>
32 #include <map>
33 #include <memory>
34 #include <string>
35 #include <utility>
36 
39 
40 namespace sc_gem5
41 {
42 
44 {
45  explicit ReportMsgInfo() :
49  sevCounts{0, 0, 0, 0}, sevLimits{-1, -1, -1, -1}, id(-1)
50  {}
51 
52  void
54  {
55  int sevLimit = sevLimits[severity];
56  int sevCount = sevCounts[severity];
57  if ((limit != -1 && limit >= count) ||
58  (sevLimit != 1 && sevLimit >= sevCount)) {
60  }
61  }
62 
64  int count;
65  int limit;
66 
70 
71  int id;
72 };
73 
75 {
77  actions(actions), count(0), limit(-1)
78  {}
79 
80  void
82  {
83  if (limit != -1 && limit >= count)
85  }
86 
88  int count;
89  int limit;
90 };
91 
94 
95 std::map<std::string, ReportMsgInfo> &reportMsgInfoMap();
96 std::map<int, std::string> &reportIdToMsgMap();
97 
98 extern int reportVerbosityLevel;
99 
103 
105 
106 extern std::unique_ptr<sc_core::sc_report> globalReportCache;
107 
108 extern bool reportWarningsAsErrors;
109 
111 {
112  public:
113  DefaultReportMessages(std::initializer_list<std::pair<int, const char *>>);
114 };
115 
116 } // namespace sc_gem5
117 
118 #endif // __SYSTEMC_UTILS_REPORT_HH__
STL pair class.
Definition: stl.hh:58
unsigned sc_actions
@ SC_MAX_SEVERITY
Definition: sc_report.hh:45
void(* sc_report_handler_proc)(const sc_report &, const sc_actions &)
int reportVerbosityLevel
Definition: report.cc:62
sc_core::sc_report_handler_proc reportHandlerProc
Definition: report.cc:68
sc_core::sc_actions reportSuppressedActions
Definition: report.cc:64
std::map< std::string, ReportMsgInfo > & reportMsgInfoMap()
Definition: report.cc:49
sc_core::sc_actions reportForcedActions
Definition: report.cc:65
std::map< int, std::string > & reportIdToMsgMap()
Definition: report.cc:56
std::unique_ptr< sc_core::sc_report > globalReportCache
Definition: report.cc:71
bool reportWarningsAsErrors
Definition: report.cc:73
ReportSevInfo reportSevInfos[sc_core::SC_MAX_SEVERITY]
Definition: report.cc:40
const char * reportSeverityNames[]
Definition: report.cc:33
sc_core::sc_actions reportCatchActions
Definition: report.cc:66
DefaultReportMessages(std::initializer_list< std::pair< int, const char * >>)
Definition: report.cc:75
sc_core::sc_actions actions
Definition: report.hh:63
int sevCounts[sc_core::SC_MAX_SEVERITY]
Definition: report.hh:68
int sevLimits[sc_core::SC_MAX_SEVERITY]
Definition: report.hh:69
sc_core::sc_actions sevActions[sc_core::SC_MAX_SEVERITY]
Definition: report.hh:67
void checkLimits(sc_core::sc_severity severity, sc_core::sc_actions &actions)
Definition: report.hh:53
void checkLimit(sc_core::sc_actions &actions)
Definition: report.hh:81
sc_core::sc_actions actions
Definition: report.hh:87
ReportSevInfo(sc_core::sc_actions actions)
Definition: report.hh:76

Generated on Wed Dec 21 2022 10:22:50 for gem5 by doxygen 1.9.1