From 1ef80a590e509daa70e08c44f22f8f2cfbcf4bc1 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Fri, 11 Oct 2019 17:57:14 +0100 Subject: [PATCH] base: generalize ExecTicks to all messages with FmtTicksOff If FmtTicksOff is given, ticks are disabled for all log messages. The original motivation of this is to bring the implementation of native traces closer to that of other traces to help refactoring done in future patches. One additional advantage of this is that sometimes we want to compare traces of a given program under different conditions, so the start of the ROI is different, and the different initial timestamp makes a diff useless by showing differences on every line. Change-Id: Idd6cb105d301b3b9b064996043f4ca75ddafe0af Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22006 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/base/SConscript | 1 + src/base/trace.cc | 3 ++- src/cpu/SConscript | 9 +++------ src/cpu/exetrace.cc | 5 +++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/base/SConscript b/src/base/SConscript index 5bf0633a9..548fda7e3 100644 --- a/src/base/SConscript +++ b/src/base/SConscript @@ -112,6 +112,7 @@ DebugFlag('Annotate', "State machine annotation debugging") DebugFlag('AnnotateQ', "State machine annotation queue debugging") DebugFlag('AnnotateVerbose', "Dump all state machine annotation details") DebugFlag('FmtFlag', "Show the --debug-flag that enabled each debug message") +DebugFlag('FmtTicksOff', "Don't show tick count on debug messages") DebugFlag('GDBAcc', "Remote debugger accesses") DebugFlag('GDBExtra', "Dump extra information on reads and writes") DebugFlag('GDBMisc', "Breakpoints, traps, watchpoints, etc.") diff --git a/src/base/trace.cc b/src/base/trace.cc index c7f338bf5..6b18787c2 100644 --- a/src/base/trace.cc +++ b/src/base/trace.cc @@ -46,6 +46,7 @@ #include "base/output.hh" #include "base/str.hh" #include "debug/FmtFlag.hh" +#include "debug/FmtTicksOff.hh" const std::string &name() { @@ -150,7 +151,7 @@ OstreamLogger::logMessage(Tick when, const std::string &name, if (!name.empty() && ignore.match(name)) return; - if (when != MaxTick) + if (!DTRACE(FmtTicksOff) && (when != MaxTick)) ccprintf(stream, "%7d: ", when); if (DTRACE(FmtFlag) && !flag.empty()) diff --git a/src/cpu/SConscript b/src/cpu/SConscript index bd6639061..0cbe013ec 100644 --- a/src/cpu/SConscript +++ b/src/cpu/SConscript @@ -46,7 +46,6 @@ DebugFlag('ExecRegDelta') DebugFlag('ExecResult', 'Format: Include results from execution') DebugFlag('ExecSymbol', 'Format: Try to include symbol names') DebugFlag('ExecThread', 'Format: Include thread ID in trace') -DebugFlag('ExecTicks', 'Format: Include tick count') DebugFlag('ExecMicro', 'Filter: Include microops') DebugFlag('ExecMacro', 'Filter: Include macroops') DebugFlag('ExecUser', 'Filter: Trace user mode instructions') @@ -63,14 +62,12 @@ DebugFlag('Mwait') CompoundFlag('ExecAll', [ 'ExecEnable', 'ExecCPSeq', 'ExecEffAddr', 'ExecFaulting', 'ExecFetchSeq', 'ExecOpClass', 'ExecRegDelta', 'ExecResult', 'ExecSymbol', 'ExecThread', - 'ExecTicks', 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel', + 'ExecMicro', 'ExecMacro', 'ExecUser', 'ExecKernel', 'ExecAsid', 'ExecFlags' ]) -CompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread', +CompoundFlag('Exec', [ 'ExecEnable', 'ExecOpClass', 'ExecThread', 'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro', 'ExecMacro', 'ExecFaulting', 'ExecUser', 'ExecKernel' ]) -CompoundFlag('ExecNoTicks', [ 'ExecEnable', 'ExecOpClass', 'ExecThread', - 'ExecEffAddr', 'ExecResult', 'ExecMicro', 'ExecMacro', 'ExecFaulting', - 'ExecUser', 'ExecKernel' ]) +CompoundFlag('ExecNoTicks', [ 'Exec', 'FmtTicksOff' ]) Source('pc_event.cc') diff --git a/src/cpu/exetrace.cc b/src/cpu/exetrace.cc index a228893f2..bbfd3d3cd 100644 --- a/src/cpu/exetrace.cc +++ b/src/cpu/exetrace.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited + * Copyright (c) 2017, 2019 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -55,6 +55,7 @@ #include "cpu/static_inst.hh" #include "cpu/thread_context.hh" #include "debug/ExecAll.hh" +#include "debug/FmtTicksOff.hh" #include "enums/OpClass.hh" using namespace std; @@ -79,7 +80,7 @@ Trace::ExeTracerRecord::traceInst(const StaticInstPtr &inst, bool ran) if (!in_user_mode && !Debug::ExecKernel) return; } - if (Debug::ExecTicks) + if (!DTRACE(FmtTicksOff)) dumpTicks(outs); outs << thread->getCpuPtr()->name() << " "; -- 2.30.2