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

--- 22 unchanged lines hidden (view full) ---

31#include <map>
32#include <sstream>
33#include <string>
34
35#include "base/logging.hh"
36#include "systemc/core/process.hh"
37#include "systemc/core/scheduler.hh"
38#include "systemc/ext/core/sc_main.hh"
39#include "systemc/ext/utils/messages.hh"
40#include "systemc/ext/utils/sc_report_handler.hh"
41#include "systemc/utils/report.hh"
42
43namespace sc_core
44{
45
46namespace
47{

--- 10 unchanged lines hidden (view full) ---

58 report(severity, msg_type, msg, SC_MEDIUM, file, line);
59}
60
61void
62sc_report_handler::report(sc_severity severity, const char *msg_type,
63 const char *msg, int verbosity, const char *file,
64 int line)
65{
66 if (!msg_type)
67 msg_type = SC_ID_UNKNOWN_ERROR_;
68
69 if (severity == SC_INFO && verbosity > sc_gem5::reportVerbosityLevel)
70 return;
71
72 sc_gem5::ReportSevInfo &sevInfo = sc_gem5::reportSevInfos[severity];
73 sc_gem5::ReportMsgInfo &msgInfo = sc_gem5::reportMsgInfoMap[msg_type];
74
75 sevInfo.count++;
76 msgInfo.count++;

--- 49 unchanged lines hidden (view full) ---

126 sc_actions previous = info.actions;
127 info.actions = actions;
128 return previous;
129}
130
131sc_actions
132sc_report_handler::set_actions(const char *msg_type, sc_actions actions)
133{
134 if (!msg_type)
135 msg_type = SC_ID_UNKNOWN_ERROR_;
136
137 sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type];
138 sc_actions previous = info.actions;
139 info.actions = actions;
140 return previous;
141}
142
143sc_actions
144sc_report_handler::set_actions(
145 const char *msg_type, sc_severity severity, sc_actions actions)
146{
147 if (!msg_type)
148 msg_type = SC_ID_UNKNOWN_ERROR_;
149
150 sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type];
151 sc_actions previous = info.sevActions[severity];
152 info.sevActions[severity] = actions;
153 return previous;
154}
155
156int
157sc_report_handler::stop_after(sc_severity severity, int limit)
158{
159 sc_gem5::ReportSevInfo &info = sc_gem5::reportSevInfos[severity];
160 int previous = info.limit;
161 info.limit = limit;
162 return previous;
163}
164
165int
166sc_report_handler::stop_after(const char *msg_type, int limit)
167{
168 if (!msg_type)
169 msg_type = SC_ID_UNKNOWN_ERROR_;
170
171 sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type];
172 int previous = info.limit;
173 info.limit = limit;
174 return previous;
175}
176
177int
178sc_report_handler::stop_after(
179 const char *msg_type, sc_severity severity, int limit)
180{
181 if (!msg_type)
182 msg_type = SC_ID_UNKNOWN_ERROR_;
183
184 sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type];
185 int previous = info.sevLimits[severity];
186 info.sevLimits[severity] = limit;
187 return previous;
188}
189
190int
191sc_report_handler::get_count(sc_severity severity)
192{
193 return sc_gem5::reportSevInfos[severity].count;
194}
195
196int
197sc_report_handler::get_count(const char *msg_type)
198{
199 if (!msg_type)
200 msg_type = SC_ID_UNKNOWN_ERROR_;
201
202 return sc_gem5::reportMsgInfoMap[msg_type].count;
203}
204
205int
206sc_report_handler::get_count(const char *msg_type, sc_severity severity)
207{
208 if (!msg_type)
209 msg_type = SC_ID_UNKNOWN_ERROR_;
210
211 return sc_gem5::reportMsgInfoMap[msg_type].sevCounts[severity];
212}
213
214int
215sc_report_handler::set_verbosity_level(int vl)
216{
217 int previous = sc_gem5::reportVerbosityLevel;
218 sc_gem5::reportVerbosityLevel = vl;

--- 197 unchanged lines hidden ---