gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
39using 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
45std::stringstream ss;
47
48// Instantiate the mock class to have a valid curTick of 0
50
51namespace gem5
52{
53namespace debug
54{
56SimpleFlag TraceTestDebugFlag("TraceTestDebugFlag",
57 "Exclusive debug flag for the trace tests");
58} // namespace debug
59} // namespace gem5
60
62std::string
63getString(std::ostream &os)
64{
65 auto buf = os.rdbuf();
66 std::ostringstream oss;
67 oss << buf;
68 return oss.str();
69}
70
72std::string
74{
75 return getString(logger->getOstream());
76}
77
79TEST(TraceTest, LogSimpleMessage)
80{
81 std::stringstream ss;
83
84 logger.logMessage(Tick(100), "", "", "Test message");
85 ASSERT_EQ(getString(&logger), " 100: Test message");
86}
87
89TEST(TraceTest, LogMessageName)
90{
91 std::stringstream ss;
93
94 logger.logMessage(Tick(100), "Foo", "", "Test message");
95 ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
96}
97
99TEST(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
109TEST(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
122TEST(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
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);
142
143 logger.logMessage(Tick(300), "Foo", "", "Test message");
144 ASSERT_EQ(getString(&logger), " 300: Foo: Test message");
145}
146
151TEST(TraceTest, LogMessageFlagEnabled)
152{
153 std::stringstream ss;
154 trace::OstreamLogger logger(ss);
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);
167}
168
170TEST(TraceTest, LogMessageActivateOne)
171{
172 std::stringstream ss;
173 trace::OstreamLogger logger(ss);
174
175 ObjectMatch activate_foo("Foo");
176 ObjectMatch activate_bar("Bar");
177
178 // Activate foo.
179 logger.setActivate(activate_foo);
180 logger.logMessage(Tick(100), "Foo", "", "Test message");
181 ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
182 logger.logMessage(Tick(100), "Bar", "", "Test message");
183 ASSERT_EQ(getString(&logger), "");
184
185 // When setting a new activate, the old activates are not kept.
186 logger.setActivate(activate_bar);
187 logger.logMessage(Tick(100), "Foo", "", "Test message");
188 ASSERT_EQ(getString(&logger), "");
189 logger.logMessage(Tick(100), "Bar", "", "Test message");
190 ASSERT_EQ(getString(&logger), " 100: Bar: Test message");
191}
192
194TEST(TraceTest, LogMessageActivateMultiple)
195{
196 std::stringstream ss;
197 trace::OstreamLogger logger(ss);
198
199 ObjectMatch activate_foo("Foo");
200 ObjectMatch activate_bar("Bar");
201 ObjectMatch activate_thy("Thy");
202
203 // Activate foo and bar
204 logger.setActivate(activate_foo);
205 logger.addActivate(activate_bar);
206 logger.logMessage(Tick(100), "Foo", "", "Test message");
207 ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
208 logger.logMessage(Tick(100), "Bar", "", "Test message");
209 ASSERT_EQ(getString(&logger), " 100: Bar: Test message");
210 logger.logMessage(Tick(100), "Thy", "", "Test message");
211 ASSERT_EQ(getString(&logger), "");
212
213 // Make sure that when setting a new activate, the old activates
214 // are not kept
215 logger.setActivate(activate_thy);
216 logger.logMessage(Tick(100), "Foo", "", "Test message");
217 ASSERT_EQ(getString(&logger), "");
218 logger.logMessage(Tick(100), "Bar", "", "Test message");
219 ASSERT_EQ(getString(&logger), "");
220 logger.logMessage(Tick(100), "Thy", "", "Test message");
221 ASSERT_EQ(getString(&logger), " 100: Thy: Test message");
222}
223
225TEST(TraceTest, LogMessageIgnoreOne)
226{
227 std::stringstream ss;
228 trace::OstreamLogger logger(ss);
229
230 ObjectMatch ignore_foo("Foo");
231 ObjectMatch ignore_bar("Bar");
232
233 // Ignore foo
234 logger.setIgnore(ignore_foo);
235 logger.logMessage(Tick(100), "Foo", "", "Test message");
236 ASSERT_EQ(getString(&logger), "");
237 logger.logMessage(Tick(100), "Bar", "", "Test message");
238 ASSERT_EQ(getString(&logger), " 100: Bar: Test message");
239
240 // Make sure that when setting a new ignore the old ignores are not kept
241 logger.setIgnore(ignore_bar);
242 logger.logMessage(Tick(100), "Foo", "", "Test message");
243 ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
244 logger.logMessage(Tick(100), "Bar", "", "Test message");
245 ASSERT_EQ(getString(&logger), "");
246}
247
249TEST(TraceTest, LogMessageIgnoreMultiple)
250{
251 std::stringstream ss;
252 trace::OstreamLogger logger(ss);
253
254 ObjectMatch ignore_foo("Foo");
255 ObjectMatch ignore_bar("Bar");
256 ObjectMatch ignore_thy("Thy");
257
258 // Ignore foo and bar
259 logger.setIgnore(ignore_foo);
260 logger.addIgnore(ignore_bar);
261 logger.logMessage(Tick(100), "Foo", "", "Test message");
262 ASSERT_EQ(getString(&logger), "");
263 logger.logMessage(Tick(100), "Bar", "", "Test message");
264 ASSERT_EQ(getString(&logger), "");
265 logger.logMessage(Tick(100), "Thy", "", "Test message");
266 ASSERT_EQ(getString(&logger), " 100: Thy: Test message");
267
268 // Make sure that when setting a new ignore, the old sub-ignores
269 // are not kept
270 logger.setIgnore(ignore_thy);
271 logger.logMessage(Tick(100), "Foo", "", "Test message");
272 ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
273 logger.logMessage(Tick(100), "Bar", "", "Test message");
274 ASSERT_EQ(getString(&logger), " 100: Bar: Test message");
275 logger.logMessage(Tick(100), "Thy", "", "Test message");
276 ASSERT_EQ(getString(&logger), "");
277}
278
280TEST(TraceTest, LogMessageActivateAndIgnore)
281{
282 std::stringstream ss;
283 trace::OstreamLogger logger(ss);
284
285 ObjectMatch foo("Foo");
286 ObjectMatch bar("Bar");
287
288 // Activate foo and ignore bar
289 logger.setActivate(foo);
290 logger.setIgnore(bar);
291 logger.logMessage(Tick(100), "Foo", "", "Test message");
292 ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
293 logger.logMessage(Tick(100), "Bar", "", "Test message");
294 ASSERT_EQ(getString(&logger), "");
295 logger.logMessage(Tick(100), "Thy", "", "Test message");
296 // When the Activate list is not empty and thy is not in the list,
297 // log of Thy will not be displayed.
298 ASSERT_EQ(getString(&logger), "");
299}
300
302TEST(TraceTest, DumpIgnored)
303{
304 std::stringstream ss;
305 trace::OstreamLogger logger(ss);
306
307 ObjectMatch ignore_foo("Foo");
308 logger.setIgnore(ignore_foo);
309 std::string message = "Test message";
310 logger.dump(Tick(100), "Foo", message.c_str(), message.size(), "");
311 ASSERT_EQ(getString(&logger), "");
312}
313
321TEST(TraceTest, DumpSimple)
322{
323 std::stringstream ss;
324 trace::OstreamLogger logger(ss);
325
327 EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
328 std::string message = "Test message";
329 logger.dump(Tick(100), "Foo", message.c_str(), message.size(), "Bar");
330#if TRACING_ON
331 ASSERT_EQ(getString(&logger),
332 // logMessage prefix
333 " 100: Bar: Foo: "
334 // Byte number + 2 spaces
335 "00000000 "
336 // 8 bytes + 1 space + 4 bytes + ((16 - 12) * 3) spaces
337 "54 65 73 74 20 6d 65 73 73 61 67 65 "
338 // 1 space + 12 chars + \n
339 " Test message\n");
340#else
341 ASSERT_EQ(getString(&logger),
342 // logMessage prefix
343 " 100: Foo: "
344 // Byte number + 2 spaces
345 "00000000 "
346 // 8 bytes + 1 space + 4 bytes + ((16 - 12) * 3) spaces
347 "54 65 73 74 20 6d 65 73 73 61 67 65 "
348 // 1 space + 12 chars + \n
349 " Test message\n");
350#endif
351 debug::changeFlag("FmtFlag", false);
353}
354
359TEST(TraceTest, DumpMultiLine)
360{
361 std::stringstream ss;
362 trace::OstreamLogger logger(ss);
363
364 std::string message =
365 "This is a very long line that will span over multiple lines";
366 logger.dump(Tick(100), "Foo", message.c_str(), message.size(), "");
367 ASSERT_EQ(getString(&logger),
368 " 100: Foo: 00000000 "
369 "54 68 69 73 20 69 73 20 61 20 76 65 72 79 20 6c This is a very l\n"
370 " 100: Foo: 00000010 "
371 "6f 6e 67 20 6c 69 6e 65 20 74 68 61 74 20 77 69 ong line that wi\n"
372 " 100: Foo: 00000020 "
373 "6c 6c 20 73 70 61 6e 20 6f 76 65 72 20 6d 75 6c ll span over mul\n"
374 " 100: Foo: 00000030 "
375 "74 69 70 6c 65 20 6c 69 6e 65 73 tiple lines\n");
376}
377
382TEST(TraceTest, DISABLED_GetNullLogger)
383{
385 ASSERT_FALSE(logger == nullptr);
386
387 gtestLogOutput.str("");
388 logger->logMessage(Tick(100), "Foo", "", "Test message");
389 ASSERT_EQ(gtestLogOutput.str(), " 100: Foo: Test message");
390}
391
393TEST(TraceTest, SetGetLogger)
394{
395 // NOTE: From now on getDebugLogger will use main_logger to avoid
396 // having to check cerr. This assumes that tests are run in the order
397 // they appear from line 1 to the last line of this file.
399
400 // Set message with local variable, and retrieve the string with
401 // the debug-logger getter
402 main_logger.logMessage(Tick(100), "Foo", "", "Test message");
403 auto logger_from_getter = trace::getDebugLogger();
404 ASSERT_EQ(getString(logger_from_getter), " 100: Foo: Test message");
405}
406
408TEST(TraceTest, Output)
409{
410 trace::getDebugLogger()->logMessage(Tick(100), "Foo", "", "Test message");
411 ASSERT_EQ(getString(trace::output()), " 100: Foo: Test message");
412}
413
415TEST(TraceTest, DprintfFlagIgnore)
416{
417 std::stringstream ss;
418 trace::OstreamLogger logger(ss);
419
420 ObjectMatch ignore_foo("Foo");
421 logger.setIgnore(ignore_foo);
422 logger.dprintf_flag(Tick(100), "Foo", "", "Test message");
423 ASSERT_EQ(getString(&logger), "");
424}
425
427TEST(TraceTest, DprintfFlagZeroArgs)
428{
429 std::stringstream ss;
430 trace::OstreamLogger logger(ss);
431
432 logger.dprintf_flag(Tick(100), "Foo", "", "Test message");
433 ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
434}
435
437TEST(TraceTest, DprintfFlagOneArg)
438{
439 std::stringstream ss;
440 trace::OstreamLogger logger(ss);
441
442 logger.dprintf_flag(Tick(100), "Foo", "", "Test %s", "message");
443 ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
444}
445
447TEST(TraceTest, DprintfFlagMultipleArgs)
448{
449 std::stringstream ss;
450 trace::OstreamLogger logger(ss);
451
452 logger.dprintf_flag(Tick(100), "Foo", "", "Test %s %c %d %x",
453 "message", 'A', 217, 0x30);
454 ASSERT_EQ(getString(&logger), " 100: Foo: Test message A 217 30");
455}
456
458TEST(TraceTest, DprintfFlagEnabled)
459{
460 std::stringstream ss;
461 trace::OstreamLogger logger(ss);
462
464 EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
465 logger.dprintf_flag(Tick(100), "Foo", "Bar", "Test %s", "message");
466#if TRACING_ON
467 ASSERT_EQ(getString(&logger), " 100: Bar: Foo: Test message");
468#else
469 ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
470#endif
471 debug::changeFlag("FmtFlag", false);
473}
474
476TEST(TraceTest, DprintfIgnore)
477{
478 std::stringstream ss;
479 trace::OstreamLogger logger(ss);
480
481 ObjectMatch ignore_foo("Foo");
482 logger.setIgnore(ignore_foo);
483 logger.dprintf(Tick(100), "Foo", "Test message");
484 ASSERT_EQ(getString(&logger), "");
485}
486
488TEST(TraceTest, DprintfEnabled)
489{
490 std::stringstream ss;
491 trace::OstreamLogger logger(ss);
492
494 EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
495 logger.dprintf(Tick(100), "Foo", "Test %s", "message");
496 ASSERT_EQ(getString(&logger), " 100: Foo: Test message");
497 debug::changeFlag("FmtFlag", false);
499}
500
502TEST(TraceTest, DprintfWrapper)
503{
504 std::stringstream ss, ss_flag;
505 trace::OstreamLogger logger(ss);
506 trace::OstreamLogger logger_flag(ss_flag);
507
508 logger.dprintf(Tick(100), "Foo", "Test %s %c %d %x",
509 "message", 'A', 217, 0x30);
510 logger_flag.dprintf_flag(Tick(100), "Foo", "", "Test %s %c %d %x",
511 "message", 'A', 217, 0x30);
512 ASSERT_EQ(getString(&logger), getString(&logger_flag));
513}
514
516TEST(TraceTest, MacroDDUMP)
517{
518 StringWrap name("Foo");
519 std::string message = "Test message";
520
521 // Flag enabled
523 EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", true));
524 EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
525 DDUMP(TraceTestDebugFlag, message.c_str(), message.size());
526#if TRACING_ON
527 ASSERT_EQ(getString(trace::output()),
528 " 0: TraceTestDebugFlag: Foo: 00000000 "
529 "54 65 73 74 20 6d 65 73 73 61 67 65 Test message\n");
530#else
531 ASSERT_EQ(getString(trace::output()), "");
532#endif
533
534 // Flag disabled
536 EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", false));
537 DDUMP(TraceTestDebugFlag, message.c_str(), message.size());
538 ASSERT_EQ(getString(trace::output()), "");
539}
540
542TEST(TraceTest, MacroDPRINTF)
543{
544 StringWrap name("Foo");
545
546 // Flag enabled
548 EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", true));
549 EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
550 DPRINTF(TraceTestDebugFlag, "Test message");
551#if TRACING_ON
552 ASSERT_EQ(getString(trace::output()),
553 " 0: TraceTestDebugFlag: Foo: Test message");
554#else
555 ASSERT_EQ(getString(trace::output()), "");
556#endif
557
558 // Flag disabled
560 EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", false));
561 DPRINTF(TraceTestDebugFlag, "Test message");
562 ASSERT_EQ(getString(trace::output()), "");
563}
564
566TEST(TraceTest, MacroDPRINTFS)
567{
568 Named named("Foo");
569#if TRACING_ON
570 Named *named_ptr = &named;
571#endif
572
573 // Flag enabled
575 EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", true));
576 EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
577#if TRACING_ON
578 DPRINTFS(TraceTestDebugFlag, named_ptr, "Test message");
579 ASSERT_EQ(getString(trace::output()),
580 " 0: TraceTestDebugFlag: Foo: Test message");
581#endif
582
583 // Flag disabled
585 EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", false));
586#if TRACING_ON
587 DPRINTFS(TraceTestDebugFlag, named_ptr, "Test message");
588 ASSERT_EQ(getString(trace::output()), "");
589#endif
590}
591
593TEST(TraceTest, MacroDPRINTFR)
594{
595 // Flag enabled
597 EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", true));
598 EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
599 DPRINTFR(TraceTestDebugFlag, "Test message");
600#if TRACING_ON
601 ASSERT_EQ(getString(trace::output()), "TraceTestDebugFlag: Test message");
602#else
603 ASSERT_EQ(getString(trace::output()), "");
604#endif
605
606 // Flag disabled
608 EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", false));
609 DPRINTFR(TraceTestDebugFlag, "Test message");
610 ASSERT_EQ(getString(trace::output()), "");
611}
612
614TEST(TraceTest, MacroDPRINTFN)
615{
616 StringWrap name("Foo");
617 DPRINTFN("Test message");
618#if TRACING_ON
619 ASSERT_EQ(getString(trace::output()), " 0: Foo: Test message");
620#else
621 ASSERT_EQ(getString(trace::output()), "");
622#endif
623}
624
626TEST(TraceTest, MacroDPRINTFNR)
627{
628 DPRINTFNR("Test message");
629#if TRACING_ON
630 ASSERT_EQ(getString(trace::output()), "Test message");
631#else
632 ASSERT_EQ(getString(trace::output()), "");
633#endif
634}
635
637TEST(TraceTest, MacroDPRINTF_UNCONDITIONAL)
638{
639 StringWrap name("Foo");
640
641 // Flag enabled
643 EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", true));
644 EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
645 DPRINTF_UNCONDITIONAL(TraceTestDebugFlag, "Test message");
646#if TRACING_ON
647 ASSERT_EQ(getString(trace::output()),
648 " 0: TraceTestDebugFlag: Foo: Test message");
649#else
650 ASSERT_EQ(getString(trace::output()), "");
651#endif
652
653 // Flag disabled
655 EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", false));
656 DPRINTF_UNCONDITIONAL(TraceTestDebugFlag, "Test message");
657#if TRACING_ON
658 ASSERT_EQ(getString(trace::output()), " 0: Foo: Test message");
659#else
660 ASSERT_EQ(getString(trace::output()), "");
661#endif
662}
663
668TEST(TraceTest, GlobalName)
669{
670 // Flag enabled
672 EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", true));
673 EXPECT_TRUE(debug::changeFlag("FmtFlag", true));
674 DPRINTF(TraceTestDebugFlag, "Test message");
675#if TRACING_ON
676 ASSERT_EQ(getString(trace::output()),
677 " 0: TraceTestDebugFlag: global: Test message");
678#else
679 ASSERT_EQ(getString(trace::output()), "");
680#endif
681
682 // Flag disabled
684 EXPECT_TRUE(debug::changeFlag("TraceTestDebugFlag", false));
685 DPRINTF(TraceTestDebugFlag, "Test message");
686 ASSERT_EQ(getString(trace::output()), "");
687}
#define DPRINTFS(x, s,...)
Definition trace.hh:217
#define DDUMP(x, data, count)
DPRINTF is a debugging trace facility that allows one to selectively enable tracing statements.
Definition trace.hh:204
#define DPRINTFN(...)
Definition trace.hh:238
#define DPRINTFNR(...)
Definition trace.hh:245
#define DPRINTFR(x,...)
Definition trace.hh:224
#define DPRINTF(x,...)
Definition trace.hh:210
Interface for things with names.
Definition named.hh:39
ObjectMatch contains a vector of expressions.
Definition match.hh:57
Debug logging base class.
Definition trace.hh:60
void setIgnore(ObjectMatch &ignore_)
Set objects to ignore.
Definition trace.hh:120
void addActivate(const ObjectMatch &activate_)
Add objects to activate.
Definition trace.hh:129
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:93
void addIgnore(const ObjectMatch &ignore_)
Add objects to ignore.
Definition trace.hh:123
virtual std::ostream & getOstream()=0
Return an ostream that can be used to send messages to the 'same place' as formatted logMessage messa...
void setActivate(ObjectMatch &activate_)
Set objects to activate.
Definition trace.hh:126
virtual void logMessage(Tick when, const std::string &name, const std::string &flag, const std::string &message)=0
Log formatted message.
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:108
void dprintf(Tick when, const std::string &name, const char *fmt, const Args &...args)
Log a single message.
Definition trace.hh:85
Logging wrapper for ostreams with the format: <when>: <name>: <message-body>
Definition trace.hh:137
void logMessage(Tick when, const std::string &name, const std::string &flag, const std::string &message) override
Log formatted message.
Definition trace.cc:148
#define DPRINTF_UNCONDITIONAL(x,...)
Definition trace.hh:252
Bitfield< 21 > ss
Definition misc_types.hh:60
Bitfield< 17 > os
Definition misc.hh:838
bool changeFlag(const char *s, bool value)
Definition debug.cc:175
SimpleFlag TraceTestDebugFlag("TraceTestDebugFlag", "Exclusive debug flag for the trace tests")
Debug flag used for the tests in this file.
void enable()
Enable/disable debug logging.
Definition trace.cc:93
void setDebugLogger(Logger *logger)
Delete the current global logger and assign a new one.
Definition trace.cc:84
void disable()
Definition trace.cc:99
Logger * getDebugLogger()
Get the current global debug logger.
Definition trace.cc:68
std::ostream & output()
Get the ostream from the current global logger.
Definition trace.cc:78
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t Tick
Tick count type.
Definition types.hh:58
thread_local GTestLogOutput gtestLogOutput
Definition logging.cc:33
const Tick MaxTick
Definition types.hh:60
const std::string & name()
Definition trace.cc:48
std::string getString(std::ostream &os)
Definition trace.test.cc:63
trace::OstreamLogger main_logger(ss)
TEST(TraceTest, LogSimpleMessage)
Test creating a simple log message.
Definition trace.test.cc:79
GTestTickHandler tickHandler
Definition trace.test.cc:49

Generated on Tue Jun 18 2024 16:24:01 for gem5 by doxygen 1.11.0