gem5  v21.1.0.2
trace.test.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Daniel R. Carvalho
3  * All rights reserved
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #include <gtest/gtest.h>
30 
31 #include <sstream>
32 #include <string>
33 
35 #include "base/gtest/logging.hh"
36 #include "base/named.hh"
37 #include "base/trace.hh"
38 
39 using namespace gem5;
40 
41 // In test SetGetLogger this logger will be assigned to be the one returned
42 // by Tracer::getDebugLogger(). All tests before that test should assume
43 // that getDebugLogger() returns a cerr-based logger, and all tests after
44 // that test should assume that this logger is returned
45 std::stringstream ss;
47 
48 // Instantiate the mock class to have a valid curTick of 0
50 
51 namespace gem5
52 {
53 namespace debug
54 {
56 SimpleFlag TraceTestDebugFlag("TraceTestDebugFlag",
57  "Exclusive debug flag for the trace tests");
58 } // namespace debug
59 } // namespace gem5
60 
62 std::string
63 getString(std::ostream &os)
64 {
65  auto buf = os.rdbuf();
66  std::ostringstream oss;
67  oss << buf;
68  return oss.str();
69 }
70 
72 std::string
74 {
75  return getString(logger->getOstream());
76 }
77 
79 TEST(TraceTest, LogSimpleMessage)
80 {
81  std::stringstream ss;
82  Trace::OstreamLogger logger(ss);
83 
84  logger.logMessage(Tick(100), "", "", "Test message");
85  ASSERT_EQ(getString(&logger), " 100: Test message");
86 }
87 
89 TEST(TraceTest, LogMessageName)
90 {
91  std::stringstream ss;
92  Trace::OstreamLogger logger(ss);
93 
94  logger.logMessage(Tick(100), "Foo", "", "Test message");
95  ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
96 }
97 
99 TEST(TraceTest, LogMessageMaxTick)
100 {
101  std::stringstream ss;
102  Trace::OstreamLogger logger(ss);
103 
104  logger.logMessage(MaxTick, "Foo", "", "Test message");
105  ASSERT_EQ(getString(&logger), "Foo: Test message");
106 }
107 
109 TEST(TraceTest, LogMessageFlagDisabled)
110 {
111  std::stringstream ss;
112  Trace::OstreamLogger logger(ss);
113 
114  logger.logMessage(Tick(100), "Foo", "Bar", "Test message");
115  ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
116 }
117 
122 TEST(TraceTest, LogMessageTickDisabledAndEnableDisable)
123 {
124  std::stringstream ss;
125  Trace::OstreamLogger logger(ss);
126 
127  logger.logMessage(Tick(100), "Foo", "", "Test message");
128  ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
129 
130  Trace::enable();
131  EXPECT_TRUE(debug::changeFlag("FmtTicksOff", true));
132 
133  logger.logMessage(Tick(200), "Foo", "", "Test message");
134 #if TRACING_ON
135  ASSERT_EQ(getString(&logger), "Foo: Test message");
136 #else
137  ASSERT_EQ(getString(&logger), " 200: Foo: Test message");
138 #endif
139 
140  debug::changeFlag("FmtTicksOff", false);
141  Trace::disable();
142 
143  logger.logMessage(Tick(300), "Foo", "", "Test message");
144  ASSERT_EQ(getString(&logger), " 300: Foo: Test message");
145 }
146 
151 TEST(TraceTest, LogMessageFlagEnabled)
152 {
153  std::stringstream ss;
154  Trace::OstreamLogger logger(ss);
155  Trace::enable();
156  EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
157 
158  logger.logMessage(Tick(100), "Foo", "Bar", "Test message");
159 #if TRACING_ON
160  ASSERT_EQ(getString(&logger), " 100: Bar: Foo: Test message");
161 #else
162  ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
163 #endif
164 
165  debug::changeFlag("FmtFlag", false);
166  Trace::disable();
167 }
168 
170 TEST(TraceTest, LogMessageIgnoreOne)
171 {
172  std::stringstream ss;
173  Trace::OstreamLogger logger(ss);
174 
175  ObjectMatch ignore_foo("Foo");
176  ObjectMatch ignore_bar("Bar");
177 
178  // Ignore foo
179  logger.setIgnore(ignore_foo);
180  logger.logMessage(Tick(100), "Foo", "", "Test message");
181  ASSERT_EQ(getString(&logger), "");
182  logger.logMessage(Tick(100), "Bar", "", "Test message");
183  ASSERT_EQ(getString(&logger), " 100: Bar: Test message");
184 
185  // Make sure that when setting a new ignore the old ignores are not kept
186  logger.setIgnore(ignore_bar);
187  logger.logMessage(Tick(100), "Foo", "", "Test message");
188  ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
189  logger.logMessage(Tick(100), "Bar", "", "Test message");
190  ASSERT_EQ(getString(&logger), "");
191 }
192 
194 TEST(TraceTest, LogMessageIgnoreMultiple)
195 {
196  std::stringstream ss;
197  Trace::OstreamLogger logger(ss);
198 
199  ObjectMatch ignore_foo("Foo");
200  ObjectMatch ignore_bar("Bar");
201  ObjectMatch ignore_thy("Thy");
202 
203  // Ignore foo and bar
204  logger.setIgnore(ignore_foo);
205  logger.addIgnore(ignore_bar);
206  logger.logMessage(Tick(100), "Foo", "", "Test message");
207  ASSERT_EQ(getString(&logger), "");
208  logger.logMessage(Tick(100), "Bar", "", "Test message");
209  ASSERT_EQ(getString(&logger), "");
210  logger.logMessage(Tick(100), "Thy", "", "Test message");
211  ASSERT_EQ(getString(&logger), " 100: Thy: Test message");
212 
213  // Make sure that when setting a new ignore, the old sub-ignores
214  // are not kept
215  logger.setIgnore(ignore_thy);
216  logger.logMessage(Tick(100), "Foo", "", "Test message");
217  ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
218  logger.logMessage(Tick(100), "Bar", "", "Test message");
219  ASSERT_EQ(getString(&logger), " 100: Bar: Test message");
220  logger.logMessage(Tick(100), "Thy", "", "Test message");
221  ASSERT_EQ(getString(&logger), "");
222 }
223 
225 TEST(TraceTest, DumpIgnored)
226 {
227  std::stringstream ss;
228  Trace::OstreamLogger logger(ss);
229 
230  ObjectMatch ignore_foo("Foo");
231  logger.setIgnore(ignore_foo);
232  std::string message = "Test message";
233  logger.dump(Tick(100), "Foo", message.c_str(), message.size(), "");
234  ASSERT_EQ(getString(&logger), "");
235 }
236 
244 TEST(TraceTest, DumpSimple)
245 {
246  std::stringstream ss;
247  Trace::OstreamLogger logger(ss);
248 
249  Trace::enable();
250  EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
251  std::string message = "Test message";
252  logger.dump(Tick(100), "Foo", message.c_str(), message.size(), "Bar");
253 #if TRACING_ON
254  ASSERT_EQ(getString(&logger),
255  // logMessage prefix
256  " 100: Bar: Foo: "
257  // Byte number + 2 spaces
258  "00000000 "
259  // 8 bytes + 1 space + 4 bytes + ((16 - 12) * 3) spaces
260  "54 65 73 74 20 6d 65 73 73 61 67 65 "
261  // 1 space + 12 chars + \n
262  " Test message\n");
263 #else
264  ASSERT_EQ(getString(&logger),
265  // logMessage prefix
266  " 100: Foo: "
267  // Byte number + 2 spaces
268  "00000000 "
269  // 8 bytes + 1 space + 4 bytes + ((16 - 12) * 3) spaces
270  "54 65 73 74 20 6d 65 73 73 61 67 65 "
271  // 1 space + 12 chars + \n
272  " Test message\n");
273 #endif
274  debug::changeFlag("FmtFlag", false);
275  Trace::disable();
276 }
277 
282 TEST(TraceTest, DumpMultiLine)
283 {
284  std::stringstream ss;
285  Trace::OstreamLogger logger(ss);
286 
287  std::string message =
288  "This is a very long line that will span over multiple lines";
289  logger.dump(Tick(100), "Foo", message.c_str(), message.size(), "");
290  ASSERT_EQ(getString(&logger),
291  " 100: Foo: 00000000 "
292  "54 68 69 73 20 69 73 20 61 20 76 65 72 79 20 6c This is a very l\n"
293  " 100: Foo: 00000010 "
294  "6f 6e 67 20 6c 69 6e 65 20 74 68 61 74 20 77 69 ong line that wi\n"
295  " 100: Foo: 00000020 "
296  "6c 6c 20 73 70 61 6e 20 6f 76 65 72 20 6d 75 6c ll span over mul\n"
297  " 100: Foo: 00000030 "
298  "74 69 70 6c 65 20 6c 69 6e 65 73 tiple lines\n");
299 }
300 
305 TEST(TraceTest, DISABLED_GetNullLogger)
306 {
308  ASSERT_FALSE(logger == nullptr);
309 
310  gtestLogOutput.str("");
311  logger->logMessage(Tick(100), "Foo", "", "Test message");
312  ASSERT_EQ(gtestLogOutput.str(), " 100: Foo: Test message");
313 }
314 
316 TEST(TraceTest, SetGetLogger)
317 {
318  // NOTE: From now on getDebugLogger will use main_logger to avoid
319  // having to check cerr. This assumes that tests are run in the order
320  // they appear from line 1 to the last line of this file.
322 
323  // Set message with local variable, and retrieve the string with
324  // the debug-logger getter
325  main_logger.logMessage(Tick(100), "Foo", "", "Test message");
326  auto logger_from_getter = Trace::getDebugLogger();
327  ASSERT_EQ(getString(logger_from_getter), " 100: Foo: Test message");
328 }
329 
331 TEST(TraceTest, Output)
332 {
333  Trace::getDebugLogger()->logMessage(Tick(100), "Foo", "", "Test message");
334  ASSERT_EQ(getString(Trace::output()), " 100: Foo: Test message");
335 }
336 
338 TEST(TraceTest, DprintfFlagIgnore)
339 {
340  std::stringstream ss;
341  Trace::OstreamLogger logger(ss);
342 
343  ObjectMatch ignore_foo("Foo");
344  logger.setIgnore(ignore_foo);
345  logger.dprintf_flag(Tick(100), "Foo", "", "Test message");
346  ASSERT_EQ(getString(&logger), "");
347 }
348 
350 TEST(TraceTest, DprintfFlagZeroArgs)
351 {
352  std::stringstream ss;
353  Trace::OstreamLogger logger(ss);
354 
355  logger.dprintf_flag(Tick(100), "Foo", "", "Test message");
356  ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
357 }
358 
360 TEST(TraceTest, DprintfFlagOneArg)
361 {
362  std::stringstream ss;
363  Trace::OstreamLogger logger(ss);
364 
365  logger.dprintf_flag(Tick(100), "Foo", "", "Test %s", "message");
366  ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
367 }
368 
370 TEST(TraceTest, DprintfFlagMultipleArgs)
371 {
372  std::stringstream ss;
373  Trace::OstreamLogger logger(ss);
374 
375  logger.dprintf_flag(Tick(100), "Foo", "", "Test %s %c %d %x",
376  "message", 'A', 217, 0x30);
377  ASSERT_EQ(getString(&logger), " 100: Foo: Test message A 217 30");
378 }
379 
381 TEST(TraceTest, DprintfFlagEnabled)
382 {
383  std::stringstream ss;
384  Trace::OstreamLogger logger(ss);
385 
386  Trace::enable();
387  EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
388  logger.dprintf_flag(Tick(100), "Foo", "Bar", "Test %s", "message");
389 #if TRACING_ON
390  ASSERT_EQ(getString(&logger), " 100: Bar: Foo: Test message");
391 #else
392  ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
393 #endif
394  debug::changeFlag("FmtFlag", false);
395  Trace::disable();
396 }
397 
399 TEST(TraceTest, DprintfIgnore)
400 {
401  std::stringstream ss;
402  Trace::OstreamLogger logger(ss);
403 
404  ObjectMatch ignore_foo("Foo");
405  logger.setIgnore(ignore_foo);
406  logger.dprintf(Tick(100), "Foo", "Test message");
407  ASSERT_EQ(getString(&logger), "");
408 }
409 
411 TEST(TraceTest, DprintfEnabled)
412 {
413  std::stringstream ss;
414  Trace::OstreamLogger logger(ss);
415 
416  Trace::enable();
417  EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
418  logger.dprintf(Tick(100), "Foo", "Test %s", "message");
419  ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
420  debug::changeFlag("FmtFlag", false);
421  Trace::disable();
422 }
423 
425 TEST(TraceTest, DprintfWrapper)
426 {
427  std::stringstream ss, ss_flag;
428  Trace::OstreamLogger logger(ss);
429  Trace::OstreamLogger logger_flag(ss_flag);
430 
431  logger.dprintf(Tick(100), "Foo", "Test %s %c %d %x",
432  "message", 'A', 217, 0x30);
433  logger_flag.dprintf_flag(Tick(100), "Foo", "", "Test %s %c %d %x",
434  "message", 'A', 217, 0x30);
435  ASSERT_EQ(getString(&logger), getString(&logger_flag));
436 }
437 
439 TEST(TraceTest, MacroDDUMP)
440 {
441  StringWrap name("Foo");
442  std::string message = "Test message";
443 
444  // Flag enabled
445  Trace::enable();
446  EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", true));
447  EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
448  DDUMP(TraceTestDebugFlag, message.c_str(), message.size());
449 #if TRACING_ON
450  ASSERT_EQ(getString(Trace::output()),
451  " 0: TraceTestDebugFlag: Foo: 00000000 "
452  "54 65 73 74 20 6d 65 73 73 61 67 65 Test message\n");
453 #else
454  ASSERT_EQ(getString(Trace::output()), "");
455 #endif
456 
457  // Flag disabled
458  Trace::disable();
459  EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", false));
460  DDUMP(TraceTestDebugFlag, message.c_str(), message.size());
461  ASSERT_EQ(getString(Trace::output()), "");
462 }
463 
465 TEST(TraceTest, MacroDPRINTF)
466 {
467  StringWrap name("Foo");
468 
469  // Flag enabled
470  Trace::enable();
471  EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", true));
472  EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
473  DPRINTF(TraceTestDebugFlag, "Test message");
474 #if TRACING_ON
475  ASSERT_EQ(getString(Trace::output()),
476  " 0: TraceTestDebugFlag: Foo: Test message");
477 #else
478  ASSERT_EQ(getString(Trace::output()), "");
479 #endif
480 
481  // Flag disabled
482  Trace::disable();
483  EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", false));
484  DPRINTF(TraceTestDebugFlag, "Test message");
485  ASSERT_EQ(getString(Trace::output()), "");
486 }
487 
489 TEST(TraceTest, MacroDPRINTFS)
490 {
491  Named named("Foo");
492 #if TRACING_ON
493  Named *named_ptr = &named;
494 #endif
495 
496  // Flag enabled
497  Trace::enable();
498  EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", true));
499  EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
500 #if TRACING_ON
501  DPRINTFS(TraceTestDebugFlag, named_ptr, "Test message");
502  ASSERT_EQ(getString(Trace::output()),
503  " 0: TraceTestDebugFlag: Foo: Test message");
504 #endif
505 
506  // Flag disabled
507  Trace::disable();
508  EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", false));
509 #if TRACING_ON
510  DPRINTFS(TraceTestDebugFlag, named_ptr, "Test message");
511  ASSERT_EQ(getString(Trace::output()), "");
512 #endif
513 }
514 
516 TEST(TraceTest, MacroDPRINTFR)
517 {
518  // Flag enabled
519  Trace::enable();
520  EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", true));
521  EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
522  DPRINTFR(TraceTestDebugFlag, "Test message");
523 #if TRACING_ON
524  ASSERT_EQ(getString(Trace::output()), "TraceTestDebugFlag: Test message");
525 #else
526  ASSERT_EQ(getString(Trace::output()), "");
527 #endif
528 
529  // Flag disabled
530  Trace::disable();
531  EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", false));
532  DPRINTFR(TraceTestDebugFlag, "Test message");
533  ASSERT_EQ(getString(Trace::output()), "");
534 }
535 
537 TEST(TraceTest, MacroDPRINTFN)
538 {
539  StringWrap name("Foo");
540  DPRINTFN("Test message");
541 #if TRACING_ON
542  ASSERT_EQ(getString(Trace::output()), " 0: Foo: Test message");
543 #else
544  ASSERT_EQ(getString(Trace::output()), "");
545 #endif
546 }
547 
549 TEST(TraceTest, MacroDPRINTFNR)
550 {
551  DPRINTFNR("Test message");
552 #if TRACING_ON
553  ASSERT_EQ(getString(Trace::output()), "Test message");
554 #else
555  ASSERT_EQ(getString(Trace::output()), "");
556 #endif
557 }
558 
560 TEST(TraceTest, MacroDPRINTF_UNCONDITIONAL)
561 {
562  StringWrap name("Foo");
563 
564  // Flag enabled
565  Trace::enable();
566  EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", true));
567  EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
568  DPRINTF_UNCONDITIONAL(TraceTestDebugFlag, "Test message");
569 #if TRACING_ON
570  ASSERT_EQ(getString(Trace::output()),
571  " 0: TraceTestDebugFlag: Foo: Test message");
572 #else
573  ASSERT_EQ(getString(Trace::output()), "");
574 #endif
575 
576  // Flag disabled
577  Trace::disable();
578  EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", false));
579  DPRINTF_UNCONDITIONAL(TraceTestDebugFlag, "Test message");
580 #if TRACING_ON
581  ASSERT_EQ(getString(Trace::output()), " 0: Foo: Test message");
582 #else
583  ASSERT_EQ(getString(Trace::output()), "");
584 #endif
585 }
586 
591 TEST(TraceTest, GlobalName)
592 {
593  // Flag enabled
594  Trace::enable();
595  EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", true));
596  EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
597  DPRINTF(TraceTestDebugFlag, "Test message");
598 #if TRACING_ON
599  ASSERT_EQ(getString(Trace::output()),
600  " 0: TraceTestDebugFlag: global: Test message");
601 #else
602  ASSERT_EQ(getString(Trace::output()), "");
603 #endif
604 
605  // Flag disabled
606  Trace::disable();
607  EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", false));
608  DPRINTF(TraceTestDebugFlag, "Test message");
609  ASSERT_EQ(getString(Trace::output()), "");
610 }
gem5::ObjectMatch
ObjectMatch contains a vector of expressions.
Definition: match.hh:56
gem5::Trace::Logger::setIgnore
void setIgnore(ObjectMatch &ignore_)
Set objects to ignore.
Definition: trace.hh:102
gem5::Trace::disable
void disable()
Definition: trace.cc:100
gem5::Trace::Logger::logMessage
virtual void logMessage(Tick when, const std::string &name, const std::string &flag, const std::string &message)=0
Log formatted message.
gem5::Trace::Logger::dprintf_flag
void dprintf_flag(Tick when, const std::string &name, const std::string &flag, const char *fmt, const Args &...args)
Log a single message with a flag prefix.
Definition: trace.hh:75
DPRINTFR
#define DPRINTFR(x,...)
Definition: trace.hh:200
gem5::debug::TraceTestDebugFlag
SimpleFlag TraceTestDebugFlag("TraceTestDebugFlag", "Exclusive debug flag for the trace tests")
Debug flag used for the tests in this file.
gem5::Trace::Logger::addIgnore
void addIgnore(const ObjectMatch &ignore_)
Add objects to ignore.
Definition: trace.hh:105
gem5::Trace::getDebugLogger
Logger * getDebugLogger()
Get the current global debug logger.
Definition: trace.cc:69
named.hh
logging.hh
gem5::MaxTick
const Tick MaxTick
Definition: types.hh:60
gem5::Named
Interface for things with names.
Definition: named.hh:38
DPRINTFNR
#define DPRINTFNR(...)
Definition: trace.hh:221
gem5::GTestTickHandler
Definition: cur_tick_fake.hh:35
gem5::statistics::Output
Definition: output.hh:65
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:186
TEST
TEST(TraceTest, LogSimpleMessage)
Test creating a simple log message.
Definition: trace.test.cc:79
gem5::StringWrap
Definition: trace.hh:145
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::Trace::Logger::getOstream
virtual std::ostream & getOstream()=0
Return an ostream that can be used to send messages to the 'same place' as formatted logMessage messa...
tickHandler
GTestTickHandler tickHandler
Definition: trace.test.cc:49
gem5::Trace::Logger
Debug logging base class.
Definition: trace.hh:58
gem5::Trace::OstreamLogger::logMessage
void logMessage(Tick when, const std::string &name, const std::string &flag, const std::string &message) override
Log formatted message.
Definition: trace.cc:149
main_logger
Trace::OstreamLogger main_logger(ss)
getString
std::string getString(std::ostream &os)
Definition: trace.test.cc:63
ss
std::stringstream ss
Definition: trace.test.cc:45
gem5::Trace::output
std::ostream & output()
Get the ostream from the current global logger.
Definition: trace.cc:79
DPRINTFS
#define DPRINTFS(x, s,...)
Definition: trace.hh:193
name
const std::string & name()
Definition: trace.cc:49
DDUMP
#define DDUMP(x, data, count)
DPRINTF is a debugging trace facility that allows one to selectively enable tracing statements.
Definition: trace.hh:180
DPRINTF_UNCONDITIONAL
#define DPRINTF_UNCONDITIONAL(x,...)
Definition: trace.hh:228
gem5::Trace::OstreamLogger
Logging wrapper for ostreams with the format: <when>: <name>: <message-body>
Definition: trace.hh:112
gem5::X86ISA::os
Bitfield< 17 > os
Definition: misc.hh:809
gem5::Trace::Logger::dprintf
void dprintf(Tick when, const std::string &name, const char *fmt, const Args &...args)
Log a single message.
Definition: trace.hh:67
gem5::debug::changeFlag
bool changeFlag(const char *s, bool value)
Definition: debug.cc:145
gem5::Trace::setDebugLogger
void setDebugLogger(Logger *logger)
Delete the current global logger and assign a new one.
Definition: trace.cc:85
gem5::gtestLogOutput
thread_local GTestLogOutput gtestLogOutput
Definition: logging.cc:33
trace.hh
DPRINTFN
#define DPRINTFN(...)
Definition: trace.hh:214
cur_tick_fake.hh
gem5::Trace::enable
void enable()
Enable/disable debug logging.
Definition: trace.cc:94
gem5::Trace::Logger::dump
void dump(Tick when, const std::string &name, const void *d, int len, const std::string &flag)
Dump a block of data of length len.
Definition: trace.cc:109
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40

Generated on Tue Sep 21 2021 12:25:00 for gem5 by doxygen 1.8.17