Daniel Carvalho has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/38697 )
Change subject: sim: Align coding style of probes
......................................................................
sim: Align coding style of probes
Fix coding style of probes for the following aspects:
- Long lines
- Return type of multi-line functions
- Name of local parameters
Also, added missing overrides
Jira: https://gem5.atlassian.net/browse/GEM5-857
Change-Id: Ibd905d1941fc203ca8308f7a3930d58515b19a97
Signed-off-by: Daniel R. Carvalho <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38697
Tested-by: kokoro <[email protected]>
Reviewed-by: Andreas Sandberg <[email protected]>
Maintainer: Andreas Sandberg <[email protected]>
---
M src/sim/probe/probe.cc
M src/sim/probe/probe.hh
2 files changed, 49 insertions(+), 31 deletions(-)
Approvals:
Andreas Sandberg: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/sim/probe/probe.cc b/src/sim/probe/probe.cc
index 3101f76..da3ca64 100644
--- a/src/sim/probe/probe.cc
+++ b/src/sim/probe/probe.cc
@@ -11,6 +11,9 @@
* unmodified and in its entirety in all distributions of the software,
* modified or unmodified, in source code or in binary form.
*
+ * Copyright (c) 2020 Inria
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
@@ -78,35 +81,39 @@
}
bool
-ProbeManager::addListener(std::string pointName, ProbeListener &listener)
+ProbeManager::addListener(std::string point_name, ProbeListener &listener)
{
- DPRINTFR(ProbeVerbose, "Probes: Call to addListener to \"%s\"
on %s.\n", pointName, object->name());
+ DPRINTFR(ProbeVerbose, "Probes: Call to addListener to \"%s\"
on %s.\n",
+ point_name, object->name());
bool added = false;
for (auto p = points.begin(); p != points.end(); ++p) {
- if ((*p)->getName() == pointName) {
+ if ((*p)->getName() == point_name) {
(*p)->addListener(&listener);
added = true;
}
}
if (!added) {
- DPRINTFR(ProbeVerbose, "Probes: Call to addListener to \"%s\"
on %s failed, no such point.\n", pointName, object->name());
+ DPRINTFR(ProbeVerbose, "Probes: Call to addListener to \"%s\" on "
+ "%s failed, no such point.\n", point_name, object->name());
}
return added;
}
bool
-ProbeManager::removeListener(std::string pointName, ProbeListener
&listener)
+ProbeManager::removeListener(std::string point_name, ProbeListener
&listener)
{
- DPRINTFR(ProbeVerbose, "Probes: Call to removeListener from \"%s\"
on %s.\n", pointName, object->name());
+ DPRINTFR(ProbeVerbose, "Probes: Call to removeListener from \"%s\" on "
+ "%s.\n", point_name, object->name());
bool removed = false;
for (auto p = points.begin(); p != points.end(); ++p) {
- if ((*p)->getName() == pointName) {
+ if ((*p)->getName() == point_name) {
(*p)->removeListener(&listener);
removed = true;
}
}
if (!removed) {
- DPRINTFR(ProbeVerbose, "Probes: Call to removeListener from \"%s\"
on %s failed, no such point.\n", pointName, object->name());
+ DPRINTFR(ProbeVerbose, "Probes: Call to removeListener from
\"%s\" "
+ "on %s failed, no such point.\n", point_name, object->name());
}
return removed;
}
@@ -114,11 +121,13 @@
void
ProbeManager::addPoint(ProbePoint &point)
{
- DPRINTFR(ProbeVerbose, "Probes: Call to addPoint \"%s\" to %s.\n",
point.getName(), object->name());
+ DPRINTFR(ProbeVerbose, "Probes: Call to addPoint \"%s\" to %s.\n",
+ point.getName(), object->name());
for (auto p = points.begin(); p != points.end(); ++p) {
if ((*p)->getName() == point.getName()) {
- DPRINTFR(ProbeVerbose, "Probes: Call to addPoint \"%s\" to %s
failed, already added.\n", point.getName(), object->name());
+ DPRINTFR(ProbeVerbose, "Probes: Call to addPoint \"%s\" to %s "
+ "failed, already added.\n", point.getName(),
object->name());
return;
}
}
diff --git a/src/sim/probe/probe.hh b/src/sim/probe/probe.hh
index 89b0a97..dede7ad 100644
--- a/src/sim/probe/probe.hh
+++ b/src/sim/probe/probe.hh
@@ -11,6 +11,9 @@
* unmodified and in its entirety in all distributions of the software,
* modified or unmodified, in source code or in binary form.
*
+ * Copyright (c) 2020 Inria
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
@@ -39,21 +42,22 @@
* @file This file describes the base components used for the probe system.
* There are currently 3 components:
*
- * ProbePoint: an event probe point i.e. send a notify from the
point
- * at which an instruction was committed.
+ * ProbePoint: an event probe point i.e. sends a notify from the
+ * point at which an instruction was committed.
*
- * ProbeListener: a listener provide a notify method that is called
when
+ * ProbeListener: a listener provides a notify method that is called
when
* a probe point event occurs. Multiple ProbeListeners
* can be added to each ProbePoint.
*
- * ProbeListenerObject: a wrapper around a SimObject that can connect to
another
- * SimObject on which is will add ProbeListeners.
+ * ProbeListenerObject: a wrapper around a SimObject that can connect to
+ * another SimObject on which it will add
ProbeListeners.
*
* ProbeManager: used to match up ProbeListeners and ProbePoints.
- * At <b>simulation init</b> this is handled by
regProbePoints
- * followed by regProbeListeners being called on each
- * SimObject in hierarchical ordering.
- * ProbeListeners can be added/removed dynamically at
runtime.
+ * At <b>simulation init</b> this is handled by
+ * regProbePoints followed by regProbeListeners being
+ * called on each SimObject in hierarchical ordering.
+ * ProbeListeners can be added/removed dynamically at
+ * runtime.
*/
#ifndef __SIM_PROBE_PROBE_HH__
@@ -173,21 +177,21 @@
/**
* @brief Add a ProbeListener to the ProbePoint named by pointName.
* If the name doesn't resolve a ProbePoint return false.
- * @param pointName the name of the ProbePoint to add the
ProbeListener to.
+ * @param point_name name of the ProbePoint to add the ProbeListener
to.
* @param listener the ProbeListener to add.
* @return true if added, false otherwise.
*/
- bool addListener(std::string pointName, ProbeListener &listener);
+ bool addListener(std::string point_name, ProbeListener &listener);
/**
* @brief Remove a ProbeListener from the ProbePoint named by
pointName.
* If the name doesn't resolve a ProbePoint return false.
- * @param pointName the name of the ProbePoint to remove the
ProbeListener
+ * @param point_name the name of the ProbePoint to remove the
ProbeListener
* from.
* @param listener the ProbeListener to remove.
* @return true if removed, false otherwise.
*/
- bool removeListener(std::string pointName, ProbeListener &listener);
+ bool removeListener(std::string point_name, ProbeListener &listener);
/**
* @brief Add a ProbePoint to this SimObject ProbeManager.
@@ -233,18 +237,19 @@
* @param name the name of the ProbePoint to add this listener to.
* @param func a pointer to the function on obj (called on notify).
*/
- ProbeListenerArg(T *obj, const std::string &name, void (T::*
func)(const Arg &))
+ ProbeListenerArg(T *obj, const std::string &name,
+ void (T::* func)(const Arg &))
: ProbeListenerArgBase<Arg>(obj->getProbeManager(), name),
object(obj),
function(func)
{}
/**
- * @brief called when the ProbePoint calls notify. This is a shim
through to
- * the function passed during construction.
+ * @brief called when the ProbePoint calls notify. This is a shim
through
+ * to the function passed during construction.
* @param val the argument value to pass.
*/
- virtual void notify(const Arg &val) { (object->*function)(val); }
+ void notify(const Arg &val) override { (object->*function)(val); }
};
/**
@@ -279,10 +284,12 @@
* @brief adds a ProbeListener to this ProbePoints notify list.
* @param l the ProbeListener to add to the notify list.
*/
- void addListener(ProbeListener *l)
+ void
+ addListener(ProbeListener *l) override
{
// check listener not already added
- if (std::find(listeners.begin(), listeners.end(), l) ==
listeners.end()) {
+ if (std::find(listeners.begin(), listeners.end(), l) ==
+ listeners.end()) {
listeners.push_back(static_cast<ProbeListenerArgBase<Arg>
*>(l));
}
}
@@ -291,7 +298,8 @@
* @brief remove a ProbeListener from this ProbePoints notify list.
* @param l the ProbeListener to remove from the notify list.
*/
- void removeListener(ProbeListener *l)
+ void
+ removeListener(ProbeListener *l) override
{
listeners.erase(std::remove(listeners.begin(), listeners.end(), l),
listeners.end());
@@ -301,7 +309,8 @@
* @brief called at the ProbePoint call site, passes arg to each
listener.
* @param arg the argument to pass to each listener.
*/
- void notify(const Arg &arg)
+ void
+ notify(const Arg &arg)
{
for (auto l = listeners.begin(); l != listeners.end(); ++l) {
(*l)->notify(arg);
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38697
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ibd905d1941fc203ca8308f7a3930d58515b19a97
Gerrit-Change-Number: 38697
Gerrit-PatchSet: 3
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s