gem5-dev@gem5.org

The gem5 Developer List

View all threads

[S] Change in gem5/gem5[develop]: sim,python: add activate option and method

YL
Yan Lee (Gerrit)
Tue, May 16, 2023 9:02 AM

Yan Lee has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/70618?usp=email )

Change subject: sim,python: add activate option and method
......................................................................

sim,python: add activate option and method

With --debug-activate option, user can add the target names into
activate list of debug log.

For example, with "--debug-activate=system.AAA.bus --debug-flags=IOXBar"
We can enable the logs of a specified bus.

Change-Id: I89ce87d784ae9736708bbc976a6bad58732bd5da
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/70618
Reviewed-by: Bobby Bruce bbruce@ucdavis.edu
Reviewed-by: Jason Lowe-Power power.jg@gmail.com
Tested-by: kokoro noreply+kokoro@google.com
Maintainer: Jason Lowe-Power power.jg@gmail.com

M src/python/m5/main.py
M src/python/m5/trace.py
M src/python/pybind11/debug.cc
3 files changed, 21 insertions(+), 1 deletion(-)

Approvals:
Jason Lowe-Power: Looks good to me, but someone else must approve; Looks
good to me, approved
Bobby Bruce: Looks good to me, approved
kokoro: Regressions pass

diff --git a/src/python/m5/main.py b/src/python/m5/main.py
index b4a3472..a68279b 100644
--- a/src/python/m5/main.py
+++ b/src/python/m5/main.py
@@ -276,6 +276,13 @@
" to be compressed automatically [Default: %default]",
)
option(

  •    "--debug-activate",
    
  •    metavar="EXPR[,EXPR]",
    
  •    action="append",
    
  •    split=",",
    
  •    help="Activate EXPR sim objects",
    
  • )

  • option(
    "--debug-ignore",
    metavar="EXPR",
    action="append",
    @@ -557,6 +564,10 @@

    trace.output(options.debug_file)

  • for activate in options.debug_activate:

  •    _check_tracing()
    
  •    trace.activate(activate)
    
  • for ignore in options.debug_ignore:
        _check_tracing()
        trace.ignore(ignore)
    

diff --git a/src/python/m5/trace.py b/src/python/m5/trace.py
index 9603914..759f96e 100644
--- a/src/python/m5/trace.py
+++ b/src/python/m5/trace.py
@@ -25,4 +25,4 @@

OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Export native methods to Python

-from _m5.trace import output, ignore, disable, enable
+from _m5.trace import output, activate, ignore, disable, enable
diff --git a/src/python/pybind11/debug.cc b/src/python/pybind11/debug.cc
index 313ca81..0087ffa 100644
--- a/src/python/pybind11/debug.cc
+++ b/src/python/pybind11/debug.cc
@@ -68,6 +68,14 @@
}

static void
+activate(const char *expr)
+{

  • ObjectMatch activate(expr);
  • trace::getDebugLogger()->addActivate(activate);
    +}

+static void
ignore(const char *expr)
{
ObjectMatch ignore(expr);
@@ -121,6 +129,7 @@
py::module_ m_trace = m_native.def_submodule("trace");
m_trace
.def("output", &output)

  •    .def("activate", &activate)
        .def("ignore", &ignore)
        .def("enable", &trace::enable)
        .def("disable", &trace::disable)
    

--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/70618?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I89ce87d784ae9736708bbc976a6bad58732bd5da
Gerrit-Change-Number: 70618
Gerrit-PatchSet: 2
Gerrit-Owner: Yan Lee yanlee@google.com
Gerrit-Reviewer: Andreas Sandberg andreas.sandberg@arm.com
Gerrit-Reviewer: Bobby Bruce bbruce@ucdavis.edu
Gerrit-Reviewer: Jason Lowe-Power jason@lowepower.com
Gerrit-Reviewer: Jason Lowe-Power power.jg@gmail.com
Gerrit-Reviewer: Yan Lee yanlee@google.com
Gerrit-Reviewer: kokoro noreply+kokoro@google.com

Yan Lee has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/70618?usp=email ) Change subject: sim,python: add activate option and method ...................................................................... sim,python: add activate option and method With --debug-activate option, user can add the target names into activate list of debug log. For example, with "--debug-activate=system.AAA.bus --debug-flags=IOXBar" We can enable the logs of a specified bus. Change-Id: I89ce87d784ae9736708bbc976a6bad58732bd5da Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/70618 Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> --- M src/python/m5/main.py M src/python/m5/trace.py M src/python/pybind11/debug.cc 3 files changed, 21 insertions(+), 1 deletion(-) Approvals: Jason Lowe-Power: Looks good to me, but someone else must approve; Looks good to me, approved Bobby Bruce: Looks good to me, approved kokoro: Regressions pass diff --git a/src/python/m5/main.py b/src/python/m5/main.py index b4a3472..a68279b 100644 --- a/src/python/m5/main.py +++ b/src/python/m5/main.py @@ -276,6 +276,13 @@ " to be compressed automatically [Default: %default]", ) option( + "--debug-activate", + metavar="EXPR[,EXPR]", + action="append", + split=",", + help="Activate EXPR sim objects", + ) + option( "--debug-ignore", metavar="EXPR", action="append", @@ -557,6 +564,10 @@ trace.output(options.debug_file) + for activate in options.debug_activate: + _check_tracing() + trace.activate(activate) + for ignore in options.debug_ignore: _check_tracing() trace.ignore(ignore) diff --git a/src/python/m5/trace.py b/src/python/m5/trace.py index 9603914..759f96e 100644 --- a/src/python/m5/trace.py +++ b/src/python/m5/trace.py @@ -25,4 +25,4 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Export native methods to Python -from _m5.trace import output, ignore, disable, enable +from _m5.trace import output, activate, ignore, disable, enable diff --git a/src/python/pybind11/debug.cc b/src/python/pybind11/debug.cc index 313ca81..0087ffa 100644 --- a/src/python/pybind11/debug.cc +++ b/src/python/pybind11/debug.cc @@ -68,6 +68,14 @@ } static void +activate(const char *expr) +{ + ObjectMatch activate(expr); + + trace::getDebugLogger()->addActivate(activate); +} + +static void ignore(const char *expr) { ObjectMatch ignore(expr); @@ -121,6 +129,7 @@ py::module_ m_trace = m_native.def_submodule("trace"); m_trace .def("output", &output) + .def("activate", &activate) .def("ignore", &ignore) .def("enable", &trace::enable) .def("disable", &trace::disable) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/70618?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I89ce87d784ae9736708bbc976a6bad58732bd5da Gerrit-Change-Number: 70618 Gerrit-PatchSet: 2 Gerrit-Owner: Yan Lee <yanlee@google.com> Gerrit-Reviewer: Andreas Sandberg <andreas.sandberg@arm.com> Gerrit-Reviewer: Bobby Bruce <bbruce@ucdavis.edu> Gerrit-Reviewer: Jason Lowe-Power <jason@lowepower.com> Gerrit-Reviewer: Jason Lowe-Power <power.jg@gmail.com> Gerrit-Reviewer: Yan Lee <yanlee@google.com> Gerrit-Reviewer: kokoro <noreply+kokoro@google.com>