[gem5-dev] Change in gem5/gem5[develop]: base: Remove hostname from hostinfo
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/41394 ) Change subject: base: Remove hostname from hostinfo .. base: Remove hostname from hostinfo This function is not used anywhere. In addition, gethostname uses a fixed host name, and sethostname is not implemented (sim/syscall_emul). If we were to handle sethostname too it would require a special conjoint implementation anyway. Change-Id: I20919a49b123a6a49582d9cfacf1fd167cb44776 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41394 Reviewed-by: Bobby R. Bruce Maintainer: Bobby R. Bruce Tested-by: kokoro --- M src/base/hostinfo.cc M src/base/hostinfo.hh 2 files changed, 0 insertions(+), 26 deletions(-) Approvals: Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/base/hostinfo.cc b/src/base/hostinfo.cc index 577ab01..0e11f3f 100644 --- a/src/base/hostinfo.cc +++ b/src/base/hostinfo.cc @@ -28,8 +28,6 @@ #include "base/hostinfo.hh" -#include - #ifdef __APPLE__ #include #include @@ -41,22 +39,6 @@ #include "base/logging.hh" #include "base/str.hh" -std::string -__get_hostname() -{ -char host[256]; -if (gethostname(host, sizeof host) == -1) -warn("could not get host name!"); -return host; -} - -std::string & -hostname() -{ -static std::string hostname = __get_hostname(); -return hostname; -} - #ifndef __APPLE__ uint64_t procInfo(const char *filename, const char *target) diff --git a/src/base/hostinfo.hh b/src/base/hostinfo.hh index 3efb6f4..d8a8910 100644 --- a/src/base/hostinfo.hh +++ b/src/base/hostinfo.hh @@ -30,14 +30,6 @@ #define __HOSTINFO_HH__ #include -#include - -/** - * Get the host name for the current machine. - * - * @return The machine's host name. - */ -std::string (); /** * Determine the simulator process' total virtual memory usage. 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/+/41394 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: I20919a49b123a6a49582d9cfacf1fd167cb44776 Gerrit-Change-Number: 41394 Gerrit-PatchSet: 3 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Clean up base/hostinfo
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/41393 ) Change subject: base: Clean up base/hostinfo .. base: Clean up base/hostinfo General fixes to the style of base/hostinfo.(cc|hh). Remove unnecessary includes. Remove signature of private functions from header. Add documentation. Remove unnecessary include in sim_events.cc. Change-Id: I54e1f13231e512d26cf0127cc80256fb5e91bf91 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41393 Reviewed-by: Bobby R. Bruce Maintainer: Bobby R. Bruce Tested-by: kokoro --- M src/base/hostinfo.cc M src/base/hostinfo.hh M src/sim/sim_events.cc 3 files changed, 15 insertions(+), 22 deletions(-) Approvals: Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/base/hostinfo.cc b/src/base/hostinfo.cc index e835a10..577ab01 100644 --- a/src/base/hostinfo.cc +++ b/src/base/hostinfo.cc @@ -26,28 +26,20 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "base/hostinfo.hh" + #include #ifdef __APPLE__ #include #include #include - -#endif - -#include "base/hostinfo.hh" - -#include -#include -#include +#else #include -#include -#include -#include +#endif #include "base/logging.hh" #include "base/str.hh" -#include "base/types.hh" std::string __get_hostname() @@ -65,10 +57,11 @@ return hostname; } +#ifndef __APPLE__ uint64_t procInfo(const char *filename, const char *target) { -int done = 0; +int done = 0; char line[80]; char format[80]; long usage; @@ -82,7 +75,7 @@ sscanf(line, format, ); fclose(fp); -return usage ; +return usage; } } } @@ -92,6 +85,7 @@ return 0; } +#endif uint64_t memUsage() diff --git a/src/base/hostinfo.hh b/src/base/hostinfo.hh index 5351cba..3efb6f4 100644 --- a/src/base/hostinfo.hh +++ b/src/base/hostinfo.hh @@ -29,20 +29,20 @@ #ifndef __HOSTINFO_HH__ #define __HOSTINFO_HH__ +#include #include -#include "base/types.hh" - -std::string __get_hostname(); - +/** + * Get the host name for the current machine. + * + * @return The machine's host name. + */ std::string (); -uint64_t procInfo(const char *filename, const char *target); - /** * Determine the simulator process' total virtual memory usage. * - * @return virtual memory usage in kilobytes + * @return Virtual memory usage in kilobytes */ uint64_t memUsage(); diff --git a/src/sim/sim_events.cc b/src/sim/sim_events.cc index af516d3..ba2cda2 100644 --- a/src/sim/sim_events.cc +++ b/src/sim/sim_events.cc @@ -45,7 +45,6 @@ #include #include "base/callback.hh" -#include "base/hostinfo.hh" #include "sim/eventq.hh" #include "sim/sim_exit.hh" #include "sim/stats.hh" 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/+/41393 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: I54e1f13231e512d26cf0127cc80256fb5e91bf91 Gerrit-Change-Number: 41393 Gerrit-PatchSet: 3 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Fix scientific number conversion in base/str
pproved 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/+/38775 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: I6a9599d8473909d274326b6f8c268e3603044ab4 Gerrit-Change-Number: 38775 Gerrit-PatchSet: 7 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Andreas Sandberg Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Add enum to_number tests
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/41334 ) Change subject: base: Add enum to_number tests .. base: Add enum to_number tests Add a test to convert a string containing a number into enums. One of the tests has been disabled to highlight an error-prone situation where a number that is not a valid enum manages to be converted to an enum. Change-Id: I7967c62feea335f3ffda40d8bf0334c20b53ee6c Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41334 Tested-by: kokoro Reviewed-by: Bobby R. Bruce Maintainer: Bobby R. Bruce --- M src/base/str.test.cc 1 file changed, 24 insertions(+), 0 deletions(-) Approvals: Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/base/str.test.cc b/src/base/str.test.cc index a064a87..f0cd483 100644 --- a/src/base/str.test.cc +++ b/src/base/str.test.cc @@ -301,6 +301,30 @@ EXPECT_FALSE(to_number(input, output)); } +TEST(StrTest, ToNumberEnum) +{ +enum Number +{ +TWO=2, +}; +Number output; +std::string input = "2"; +EXPECT_TRUE(to_number(input, output)); +EXPECT_EQ(TWO, output); +} + +/** Test that trying to convert a number to an enum that is not valid fails. */ +TEST(StrTest, DISABLED_ToNumberEnumInvalid) +{ +enum Number +{ +TWO=2, +}; +Number output; +std::string input = "3"; +EXPECT_FALSE(to_number(input, output)); +} + TEST(StrTest, ToNumberFloat) { float output; The change was submitted with unreviewed changes in the following files: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41334 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: I7967c62feea335f3ffda40d8bf0334c20b53ee6c Gerrit-Change-Number: 41334 Gerrit-PatchSet: 4 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Add unit test for base/logging
sting::internal::GetCapturedStderr(), +"hack: sample message\n"); + +testing::internal::CaptureStderr(); +hack("sample message\nwith \nthree lines"); +ASSERT_EQ(testing::internal::GetCapturedStderr(), +"hack: sample message\nwith \nthree lines\n"); + +testing::internal::CaptureStderr(); +hack("sample message\n\n"); +ASSERT_EQ(testing::internal::GetCapturedStderr(), +"hack: sample message\n\n"); + +testing::internal::CaptureStderr(); +hack("%s message", "sample"); +ASSERT_EQ(testing::internal::GetCapturedStderr(), +"hack: sample message\n"); + +testing::internal::CaptureStderr(); +hack("sample %s %d\n", "message", 2); +ASSERT_EQ(testing::internal::GetCapturedStderr(), +"hack: sample message 2\n"); +} + +/** Test that warn_once only prints the message once in a loop. */ +TEST(LoggingTest, WarnOnce) +{ +for (int i = 0; i < 10; i++) { +testing::internal::CaptureStderr(); +warn_once("message\n"); +ASSERT_EQ(testing::internal::GetCapturedStderr(), +(i == 0) ? "warn: message\n" : ""); +} +} + +/** Test that inform_once only prints the message once in a loop. */ +TEST(LoggingTest, InformOnce) +{ +for (int i = 0; i < 10; i++) { +testing::internal::CaptureStderr(); +inform_once("message\n"); + ASSERT_EQ(testing::internal::GetCapturedStderr(), +(i == 0) ? "info: message\n" : ""); +} +} + +/** Test that hack_once only prints the message once in a loop. */ +TEST(LoggingTest, HackOnce) +{ +for (int i = 0; i < 10; i++) { +testing::internal::CaptureStderr(); +hack_once("message\n"); +ASSERT_EQ(testing::internal::GetCapturedStderr(), +(i == 0) ? "hack: message\n" : ""); +} +} + +/** Test that warn_if only prints the message when the condition is true. */ +TEST(LoggingTest, WarnIf) +{ +for (int i = 0; i < 10; i++) { +testing::internal::CaptureStderr(); +warn_if(i % 4, "message\n"); +ASSERT_EQ(testing::internal::GetCapturedStderr(), +(i % 4) ? "warn: message\n" : ""); +} +} + +/** Test that warn_if_once only prints the message once in a loop. */ +TEST(LoggingTest, WarnIfOnce) +{ +for (int i = 0; i < 10; i++) { +testing::internal::CaptureStderr(); +warn_if_once(i == 3, "message\n"); +ASSERT_EQ(testing::internal::GetCapturedStderr(), +(i == 3) ? "warn: message\n" : ""); +} +} + +#ifndef NDEBUG +/** Test macro chatty_assert. */ +TEST(LoggingDeathTest, ChattyAssert) +{ +chatty_assert(true, "message\n"); +ASSERT_DEATH(chatty_assert(false, "message\n"), ::testing::StartsWith( +"panic: assert(false) failed: message\nMemory Usage:")); +} +#endif -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41398 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: Ia890c06b44134b70eada7a9deadef882f00a5c27 Gerrit-Change-Number: 41398 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: tests: Remove GTestLogger
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/41396 ) Change subject: tests: Remove GTestLogger .. tests: Remove GTestLogger Use the default logger functionality instead, and print the log to cerr. Change-Id: If4510eeeb40c936f986d84b639206c5884a08984 Signed-off-by: Daniel R. Carvalho --- M src/base/gtest/logging.cc 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/base/gtest/logging.cc b/src/base/gtest/logging.cc index d9cb9eb..8d40682 100644 --- a/src/base/gtest/logging.cc +++ b/src/base/gtest/logging.cc @@ -43,15 +43,6 @@ struct GTestException {}; -class GTestLogger : public Logger -{ - public: -using Logger::Logger; - - protected: -void log(const Loc , std::string s) override { SUCCEED() << s; } -}; - class GTestExitLogger : public Logger { public: @@ -69,9 +60,9 @@ GTestExitLogger panicLogger("panic: "); GTestExitLogger fatalLogger("fatal: "); -GTestLogger warnLogger("warn: "); -GTestLogger infoLogger("info: "); -GTestLogger hackLogger("hack: "); +Logger warnLogger("warn: "); +Logger infoLogger("info: "); +Logger hackLogger("hack: "); } // anonymous namespace -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41396 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: If4510eeeb40c936f986d84b639206c5884a08984 Gerrit-Change-Number: 41396 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Fix incorrect use of Logger::print
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/41399 ) Change subject: base: Fix incorrect use of Logger::print .. base: Fix incorrect use of Logger::print Previously when a formatted message was printed in a Logger it would use the wrong function, and thus skip the warning triggered by ccprintf. Fix this by merging two prints to avoid ambiguity. Change-Id: Idc51d2ef28ab4721d2be16f3e5fce19c494a0d47 Signed-off-by: Daniel R. Carvalho --- M src/base/logging.hh M src/base/logging.test.cc 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/base/logging.hh b/src/base/logging.hh index e740e1d..4ef700a 100644 --- a/src/base/logging.hh +++ b/src/base/logging.hh @@ -90,24 +90,20 @@ virtual ~Logger() {}; -void -print(const Loc , const std::string ) -{ -std::stringstream ss; -ss << prefix << str; -if (str.length() && str.back() != '\n' && str.back() != '\r') -ss << std::endl; -if (!enabled) -return; -log(loc, ss.str()); -} - template void print(const Loc , const char *format, const Args &...args) { std::stringstream ss; ccprintf(ss, format, args...); -print(loc, ss.str()); +const std::string str = ss.str(); + +std::stringstream ss_formatted; +ss_formatted << prefix << str; +if (str.length() && str.back() != '\n' && str.back() != '\r') +ss_formatted << std::endl; +if (!enabled) +return; +log(loc, ss_formatted.str()); } template void diff --git a/src/base/logging.test.cc b/src/base/logging.test.cc index 3075ab7..c979148 100644 --- a/src/base/logging.test.cc +++ b/src/base/logging.test.cc @@ -141,7 +141,7 @@ * Test the variadic-arg print for strings with arguments missing using * TestLogger. */ -TEST(LoggingTest, DISABLED_TestLoggerVariadicStringMissingPrint) +TEST(LoggingTest, TestLoggerVariadicStringMissingPrint) { TestLogger logger("test: "); -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41399 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: Idc51d2ef28ab4721d2be16f3e5fce19c494a0d47 Gerrit-Change-Number: 41399 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: tests: Remove gtest/logging
ript +++ b/src/sim/SConscript @@ -86,7 +86,7 @@ GTest('byteswap.test', 'byteswap.test.cc', '../base/types.cc') GTest('guest_abi.test', 'guest_abi.test.cc') -GTest('proxy_ptr.test', 'proxy_ptr.test.cc') +GTest('proxy_ptr.test', 'proxy_ptr.test.cc', with_tag('gem5 logging')) if env['TARGET_ISA'] != 'null': SimObject('InstTracer.py') -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41397 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: Ib2dc780e06e7790526b34fb12d15dbb588e6c425 Gerrit-Change-Number: 41397 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Remove hostname from hostinfo
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/41394 ) Change subject: base: Remove hostname from hostinfo .. base: Remove hostname from hostinfo This function is not used anywhere. In addition, gethostname uses a fixed host name, and sethostname is not implemented (sim/syscall_emul). If we were to handle sethostname too it would require a special conjoint implementation anyway. Change-Id: I20919a49b123a6a49582d9cfacf1fd167cb44776 Signed-off-by: Daniel R. Carvalho --- M src/base/hostinfo.cc M src/base/hostinfo.hh 2 files changed, 0 insertions(+), 26 deletions(-) diff --git a/src/base/hostinfo.cc b/src/base/hostinfo.cc index 577ab01..0e11f3f 100644 --- a/src/base/hostinfo.cc +++ b/src/base/hostinfo.cc @@ -28,8 +28,6 @@ #include "base/hostinfo.hh" -#include - #ifdef __APPLE__ #include #include @@ -41,22 +39,6 @@ #include "base/logging.hh" #include "base/str.hh" -std::string -__get_hostname() -{ -char host[256]; -if (gethostname(host, sizeof host) == -1) -warn("could not get host name!"); -return host; -} - -std::string & -hostname() -{ -static std::string hostname = __get_hostname(); -return hostname; -} - #ifndef __APPLE__ uint64_t procInfo(const char *filename, const char *target) diff --git a/src/base/hostinfo.hh b/src/base/hostinfo.hh index 3efb6f4..d8a8910 100644 --- a/src/base/hostinfo.hh +++ b/src/base/hostinfo.hh @@ -30,14 +30,6 @@ #define __HOSTINFO_HH__ #include -#include - -/** - * Get the host name for the current machine. - * - * @return The machine's host name. - */ -std::string (); /** * Determine the simulator process' total virtual memory usage. -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41394 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: I20919a49b123a6a49582d9cfacf1fd167cb44776 Gerrit-Change-Number: 41394 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Add default log functionality to Logger
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/41395 ) Change subject: base: Add default log functionality to Logger .. base: Add default log functionality to Logger The only difference between the NormalLogger and Logger is a simple implementation for log(), which is then called by the other loggers. Since this is common to everybody, move this implementation to Logger and remove NormalLogger. This makes it possible to test the NormalLoggers using the current gtest logging framework. Change-Id: I6805fa14f58ddc7d37b00fcd7fcacb32e0b5d456 Signed-off-by: Daniel R. Carvalho --- M src/base/logging.cc M src/base/logging.hh 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/base/logging.cc b/src/base/logging.cc index b8f20f9..1290455 100644 --- a/src/base/logging.cc +++ b/src/base/logging.cc @@ -46,27 +46,18 @@ namespace { -class NormalLogger : public Logger +class ExitLogger : public Logger { public: using Logger::Logger; protected: -void log(const Loc , std::string s) override { std::cerr << s; } -}; - -class ExitLogger : public NormalLogger -{ - public: -using NormalLogger::NormalLogger; - - protected: void log(const Loc , std::string s) override { std::stringstream ss; ccprintf(ss, "Memory Usage: %ld KBytes\n", memUsage()); -NormalLogger::log(loc, s + ss.str()); +Logger::log(loc, s + ss.str()); } }; @@ -81,9 +72,9 @@ ExitLogger panicLogger("panic: "); FatalLogger fatalLogger("fatal: "); -NormalLogger warnLogger("warn: "); -NormalLogger infoLogger("info: "); -NormalLogger hackLogger("hack: "); +Logger warnLogger("warn: "); +Logger infoLogger("info: "); +Logger hackLogger("hack: "); } // anonymous namespace diff --git a/src/base/logging.hh b/src/base/logging.hh index 29a9563..e740e1d 100644 --- a/src/base/logging.hh +++ b/src/base/logging.hh @@ -126,7 +126,8 @@ protected: bool enabled; -virtual void log(const Loc , std::string s) = 0; +/** Generates the log message. By default it is sent to cerr. */ +virtual void log(const Loc , std::string s) { std::cerr << s; } virtual void exit() { /* Fall through to the abort in exit_helper. */ } const char *prefix; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41395 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: I6805fa14f58ddc7d37b00fcd7fcacb32e0b5d456 Gerrit-Change-Number: 41395 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Clean up base/hostinfo
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/41393 ) Change subject: base: Clean up base/hostinfo .. base: Clean up base/hostinfo General fixes to the style of base/hostinfo.(cc|hh). Remove unnecessary includes. Remove signature of private functions from header. Add documentation. Remove unnecessary include in sim_events.cc. Change-Id: I54e1f13231e512d26cf0127cc80256fb5e91bf91 Signed-off-by: Daniel R. Carvalho --- M src/base/hostinfo.cc M src/base/hostinfo.hh M src/sim/sim_events.cc 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/base/hostinfo.cc b/src/base/hostinfo.cc index e835a10..577ab01 100644 --- a/src/base/hostinfo.cc +++ b/src/base/hostinfo.cc @@ -26,28 +26,20 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "base/hostinfo.hh" + #include #ifdef __APPLE__ #include #include #include - -#endif - -#include "base/hostinfo.hh" - -#include -#include -#include +#else #include -#include -#include -#include +#endif #include "base/logging.hh" #include "base/str.hh" -#include "base/types.hh" std::string __get_hostname() @@ -65,10 +57,11 @@ return hostname; } +#ifndef __APPLE__ uint64_t procInfo(const char *filename, const char *target) { -int done = 0; +int done = 0; char line[80]; char format[80]; long usage; @@ -82,7 +75,7 @@ sscanf(line, format, ); fclose(fp); -return usage ; +return usage; } } } @@ -92,6 +85,7 @@ return 0; } +#endif uint64_t memUsage() diff --git a/src/base/hostinfo.hh b/src/base/hostinfo.hh index 5351cba..3efb6f4 100644 --- a/src/base/hostinfo.hh +++ b/src/base/hostinfo.hh @@ -29,20 +29,20 @@ #ifndef __HOSTINFO_HH__ #define __HOSTINFO_HH__ +#include #include -#include "base/types.hh" - -std::string __get_hostname(); - +/** + * Get the host name for the current machine. + * + * @return The machine's host name. + */ std::string (); -uint64_t procInfo(const char *filename, const char *target); - /** * Determine the simulator process' total virtual memory usage. * - * @return virtual memory usage in kilobytes + * @return Virtual memory usage in kilobytes */ uint64_t memUsage(); diff --git a/src/sim/sim_events.cc b/src/sim/sim_events.cc index af516d3..ba2cda2 100644 --- a/src/sim/sim_events.cc +++ b/src/sim/sim_events.cc @@ -45,7 +45,6 @@ #include #include "base/callback.hh" -#include "base/hostinfo.hh" #include "sim/eventq.hh" #include "sim/sim_exit.hh" #include "sim/stats.hh" -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41393 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: I54e1f13231e512d26cf0127cc80256fb5e91bf91 Gerrit-Change-Number: 41393 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Add unit test for base/trace.hh
h tracing on. */ +TEST(TraceTest, MacroDPRINTF) +{ +StringWrap name("Foo"); + +// Flag enabled +Trace::enable(); +EXPECT_TRUE(Debug::changeFlag("TraceTestDebugFlag", true)); +EXPECT_TRUE(Debug::changeFlag("FmtFlag", true)); +DPRINTF(TraceTestDebugFlag, "Test message"); +#if TRACING_ON +ASSERT_EQ(getString(Trace::output()), +" 0: TraceTestDebugFlag: Foo: Test message"); +#else +ASSERT_EQ(getString(Trace::output()), ""); +#endif + +// Flag disabled +Trace::disable(); +EXPECT_TRUE(Debug::changeFlag("TraceTestDebugFlag", false)); +DPRINTF(TraceTestDebugFlag, "Test message"); +ASSERT_EQ(getString(Trace::output()), ""); +} + +/** Test DPRINTFS with tracing on. */ +TEST(TraceTest, MacroDPRINTFS) +{ +Named named("Foo"); +#if TRACING_ON +Named *named_ptr = +#endif + +// Flag enabled +Trace::enable(); +EXPECT_TRUE(Debug::changeFlag("TraceTestDebugFlag", true)); +EXPECT_TRUE(Debug::changeFlag("FmtFlag", true)); +DPRINTFS(TraceTestDebugFlag, named_ptr, "Test message"); +#if TRACING_ON +ASSERT_EQ(getString(Trace::output()), +" 0: TraceTestDebugFlag: Foo: Test message"); +#else +ASSERT_EQ(getString(Trace::output()), ""); +#endif + +// Flag disabled +Trace::disable(); +EXPECT_TRUE(Debug::changeFlag("TraceTestDebugFlag", false)); +DPRINTFS(TraceTestDebugFlag, named_ptr, "Test message"); +ASSERT_EQ(getString(Trace::output()), ""); +} + +/** Test DPRINTFR with tracing on. */ +TEST(TraceTest, MacroDPRINTFR) +{ +// Flag enabled +Trace::enable(); +EXPECT_TRUE(Debug::changeFlag("TraceTestDebugFlag", true)); +EXPECT_TRUE(Debug::changeFlag("FmtFlag", true)); +DPRINTFR(TraceTestDebugFlag, "Test message"); +#if TRACING_ON +ASSERT_EQ(getString(Trace::output()), "TraceTestDebugFlag: Test message"); +#else +ASSERT_EQ(getString(Trace::output()), ""); +#endif + +// Flag disabled +Trace::disable(); +EXPECT_TRUE(Debug::changeFlag("TraceTestDebugFlag", false)); +DPRINTFR(TraceTestDebugFlag, "Test message"); +ASSERT_EQ(getString(Trace::output()), ""); +} + +/** Test DPRINTFN with tracing on. */ +TEST(TraceTest, MacroDPRINTFN) +{ +StringWrap name("Foo"); +DPRINTFN("Test message"); +#if TRACING_ON +ASSERT_EQ(getString(Trace::output()), " 0: Foo: Test message"); +#else +ASSERT_EQ(getString(Trace::output()), ""); +#endif +} + +/** Test DPRINTFNR with tracing on. */ +TEST(TraceTest, MacroDPRINTFNR) +{ +DPRINTFNR("Test message"); +#if TRACING_ON +ASSERT_EQ(getString(Trace::output()), "Test message"); +#else +ASSERT_EQ(getString(Trace::output()), ""); +#endif +} + +/** Test DPRINTF_UNCONDITIONAL with tracing on. */ +TEST(TraceTest, MacroDPRINTF_UNCONDITIONAL) +{ +StringWrap name("Foo"); + +// Flag enabled +Trace::enable(); +EXPECT_TRUE(Debug::changeFlag("TraceTestDebugFlag", true)); + EXPECT_TRUE(Debug::changeFlag("FmtFlag", true)); +DPRINTF_UNCONDITIONAL(TraceTestDebugFlag, "Test message"); +#if TRACING_ON +ASSERT_EQ(getString(Trace::output()), +" 0: TraceTestDebugFlag: Foo: Test message"); +#else +ASSERT_EQ(getString(Trace::output()), ""); +#endif + +// Flag disabled +Trace::disable(); +EXPECT_TRUE(Debug::changeFlag("TraceTestDebugFlag", false)); +DPRINTF_UNCONDITIONAL(TraceTestDebugFlag, "Test message"); +#if TRACING_ON +ASSERT_EQ(getString(Trace::output()), " 0: Foo: Test message"); +#else +ASSERT_EQ(getString(Trace::output()), ""); +#endif +} + +/** + * Test that there is a global name() to fall through when a locally scoped + * name() is not defined. + */ +TEST(TraceTest, GlobalName) +{ +// Flag enabled +Trace::enable(); +EXPECT_TRUE(Debug::changeFlag("TraceTestDebugFlag", true)); +EXPECT_TRUE(Debug::changeFlag("FmtFlag", true)); +DPRINTF(TraceTestDebugFlag, "Test message"); +#if TRACING_ON +ASSERT_EQ(getString(Trace::output()), +" 0: TraceTestDebugFlag: global: Test message"); +#else +ASSERT_EQ(getString(Trace::output()), ""); +#endif + +// Flag disabled +Trace::disable(); +EXPECT_TRUE(Debug::changeFlag("TraceTestDebugFlag", false)); +DPRINTF(TraceTestDebugFlag, "Test message"); +ASSERT_EQ(getString(Trace::output()), ""); +} diff --git a/src/sim/SConscript b/src/sim/SConscript index 276a19e..6f06640 100644 --- a/src/sim/SConscript +++ b/src/sim/SConscript @@ -42,9 +42,9 @@ SimObject('PowerDomain.py') Source('async.cc') -Source('backtrace_%s.cc' % env['BACKTRACE_IMPL']) +Source('backtrace_%s.cc' % env['BACKTRACE_IMPL'], add_tags='gem5 trace') Source('core.cc') -Source('cur_tick.cc') +Source('cur_tick.cc', add_tags='gem5 trace') Source('tags.cc') Source('cxx_config.cc') Source('cxx_manager.cc') -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41336 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: Ib1e17de3c772146596a26a2ce5aa7a6310bf7938 Gerrit-Change-Number: 41336 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Add enum to_number tests
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/41334 ) Change subject: base: Add enum to_number tests .. base: Add enum to_number tests Add a test to convert a string containing a number into enums. One of the tests has been disabled to highlight an error-prone situation where a number that is not a valid enum manages to be converted to an enum. Change-Id: I7967c62feea335f3ffda40d8bf0334c20b53ee6c Signed-off-by: Daniel R. Carvalho --- M src/base/str.test.cc 1 file changed, 24 insertions(+), 0 deletions(-) diff --git a/src/base/str.test.cc b/src/base/str.test.cc index d1d1677..d3cbc3d 100644 --- a/src/base/str.test.cc +++ b/src/base/str.test.cc @@ -353,6 +353,30 @@ EXPECT_FALSE(to_number(input, output)); } +TEST(StrTest, ToNumberEnum) +{ +enum Number +{ +TWO=2, +}; +Number output; +std::string input = "2"; +EXPECT_TRUE(to_number(input, output)); +EXPECT_EQ(TWO, output); +} + +/** Test that trying to convert a number to an enum that is not valid fails. */ +TEST(StrTest, DISABLED_ToNumberEnumInvalid) +{ +enum Number +{ +TWO=2, +}; +Number output; +std::string input = "3"; +EXPECT_FALSE(to_number(input, output)); +} + TEST(StrTest, ToNumberFloat) { float output; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41334 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: I7967c62feea335f3ffda40d8bf0334c20b53ee6c Gerrit-Change-Number: 41334 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Remove DDUMPN
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/41335 ) Change subject: base: Remove DDUMPN .. base: Remove DDUMPN It is not used in the codebase. It has been broken (not compilable) since commit 105b2c8914946867f040caf6a8ff7da3c5d028d7. Change-Id: I6fe048910ad1d39b6b10af509ba84aab1792b8fb Signed-off-by: Daniel R. Carvalho --- M src/base/trace.hh 1 file changed, 0 insertions(+), 6 deletions(-) diff --git a/src/base/trace.hh b/src/base/trace.hh index f7c0066..b5d579d 100644 --- a/src/base/trace.hh +++ b/src/base/trace.hh @@ -172,7 +172,6 @@ * \def DPRINTF(x, ...) * \def DPRINTFS(x, s, ...) * \def DPRINTFR(x, ...) - * \def DDUMPN(data, count) * \def DPRINTFN(...) * \def DPRINTFNR(...) * \def DPRINTF_UNCONDITIONAL(x, ...) @@ -214,10 +213,6 @@ } \ } while (0) -#define DDUMPN(data, count) do { \ -Trace::getDebugLogger()->dump(curTick(), name(), data, count); \ -} while (0) - #define DPRINTFN(...) do { \ Trace::getDebugLogger()->dprintf(curTick(), name(), __VA_ARGS__); \ } while (0) @@ -237,7 +232,6 @@ #define DPRINTF(x, ...) do {} while (0) #define DPRINTFS(x, ...) do {} while (0) #define DPRINTFR(...) do {} while (0) -#define DDUMPN(data, count) do {} while (0) #define DPRINTFN(...) do {} while (0) #define DPRINTFNR(...) do {} while (0) #define DPRINTF_UNCONDITIONAL(x, ...) do {} while (0) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41335 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: I6fe048910ad1d39b6b10af509ba84aab1792b8fb Gerrit-Change-Number: 41335 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Fix scientific number conversion in base/str
https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I35adc188ec958d7c5a4de97121f28a7c3145c132 Gerrit-Change-Number: 41333 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Fix copyright of base/stats/SConscript
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/40755 ) Change subject: base: Fix copyright of base/stats/SConscript .. base: Fix copyright of base/stats/SConscript The original copyright was accidentally removed by e59557af500d1633b1f41b023d6c072acaf145a0. Change-Id: Ib3b7a34ea889fbd9a6f2a8e21a6bb24432939da9 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40755 Reviewed-by: Giacomo Travaglini Reviewed-by: Bobby R. Bruce Maintainer: Bobby R. Bruce Tested-by: kokoro --- M src/base/stats/SConscript 1 file changed, 1 insertion(+), 0 deletions(-) Approvals: Giacomo Travaglini: Looks good to me, approved Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/base/stats/SConscript b/src/base/stats/SConscript index 69ac275..8f037ba 100644 --- a/src/base/stats/SConscript +++ b/src/base/stats/SConscript @@ -1,6 +1,7 @@ # -*- mode:python -*- # # Copyright (c) 2021 Daniel R. Carvalho +# Copyright (c) 2006 The Regents of The University of Michigan # All rights reserved. # # Redistribution and use in source and binary forms, with or without -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40755 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: Ib3b7a34ea889fbd9a6f2a8e21a6bb24432939da9 Gerrit-Change-Number: 40755 Gerrit-PatchSet: 2 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Giacomo Travaglini Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: dev: Fix register bank unit test in .debug
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/40836 ) Change subject: dev: Fix register bank unit test in .debug .. dev: Fix register bank unit test in .debug The lack of definition of this static variable was throwing and undefined reference error when running scons build/X86/unittests.opt. For more info, check https://stackoverflow.com/questions/ 8016780/undefined-reference-to-static-constexpr-char Change-Id: Id736dc42a82aea871da6a53c06d89fd399d3559a Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40836 Reviewed-by: Jason Lowe-Power Reviewed-by: Gabe Black Maintainer: Jason Lowe-Power Tested-by: kokoro --- M src/dev/reg_bank.test.cc 1 file changed, 8 insertions(+), 0 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, but someone else must approve; Looks good to me, approved Gabe Black: Looks good to me, approved kokoro: Regressions pass diff --git a/src/dev/reg_bank.test.cc b/src/dev/reg_bank.test.cc index 6e655e2..f72642d 100644 --- a/src/dev/reg_bank.test.cc +++ b/src/dev/reg_bank.test.cc @@ -82,6 +82,8 @@ buf.fill(0xff); } }; +// Needed by C++14 and lower +constexpr size_t RegisterRazTest::RazSize; TEST_F(RegisterRazTest, Name) { @@ -166,6 +168,8 @@ buf.fill(0x00); } }; +// Needed by C++14 and lower +constexpr size_t RegisterRaoTest::RaoSize; TEST_F(RegisterRaoTest, Name) { @@ -252,6 +256,8 @@ 0x70, 0x80, 0x90, 0xa0, 0xb0, 0xc0} {} }; +// Needed by C++14 and lower +constexpr size_t RegisterBufTest::RegSize; TEST_F(RegisterBufTest, Name) { @@ -456,6 +462,8 @@ buf{0x1, 0x2, 0x3, 0x4, 0x5, 0x6} {} }; +// Needed by C++14 and lower +constexpr size_t TypedRegisterTest::RegSize; TEST_F(TypedRegisterTest, DefaultConstructor) { -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40836 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: Id736dc42a82aea871da6a53c06d89fd399d3559a Gerrit-Change-Number: 40836 Gerrit-PatchSet: 2 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Fix storage unit test in .fast
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/40835 ) Change subject: base: Fix storage unit test in .fast .. base: Fix storage unit test in .fast These tests depend on assertions being triggered, which does not happen in .fast. Change-Id: I0dd78f184809a453035046bc76640dfb5988bb5f Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40835 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- M src/base/stats/storage.test.cc 1 file changed, 8 insertions(+), 0 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/base/stats/storage.test.cc b/src/base/stats/storage.test.cc index 78df23d..3218438 100644 --- a/src/base/stats/storage.test.cc +++ b/src/base/stats/storage.test.cc @@ -175,6 +175,7 @@ increaseTick(); } +#if TRACING_ON /** * Test whether getting the result in a different tick triggers an assertion. */ @@ -184,6 +185,7 @@ increaseTick(); ASSERT_DEATH(stor.result(), ".+"); } +#endif /** * Test whether getting the result in a different tick does not trigger an @@ -266,6 +268,7 @@ ASSERT_FALSE(stor.zero()); } +#if TRACING_ON /** Test that an assertion is thrown when bucket size is 0. */ TEST(StatsDistStorDeathTest, BucketSize0) { @@ -273,6 +276,7 @@ EXPECT_ANY_THROW(Stats::DistStor::Params params(0, 5, 0)); testing::internal::GetCapturedStderr(); } +#endif /** * Test whether zero is correctly set as the reset value. The test order is @@ -492,6 +496,7 @@ checkExpectedDistData(data, expected_data, true); } +#if TRACING_ON /** Test that an assertion is thrown when not enough buckets are provided. */ TEST(StatsHistStorDeathTest, NotEnoughBuckets0) { @@ -507,6 +512,7 @@ EXPECT_ANY_THROW(Stats::HistStor::Params params(1)); testing::internal::GetCapturedStderr(); } +#endif /** * Test whether zero is correctly set as the reset value. The test order is @@ -913,6 +919,7 @@ prepareCheckHistStor(params, values, 0, expected_data); } +#if TRACING_ON /** Test whether adding storages with different sizes triggers an assertion. */ TEST(StatsHistStorDeathTest, AddDifferentSize) { @@ -942,6 +949,7 @@ ASSERT_DEATH(stor.add(), ".+"); } +#endif /** Test merging two histograms. */ TEST(StatsHistStorTest, Add) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40835 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: I0dd78f184809a453035046bc76640dfb5988bb5f Gerrit-Change-Number: 40835 Gerrit-PatchSet: 2 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Fix storage unit test in .fast
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/40835 ) Change subject: base: Fix storage unit test in .fast .. base: Fix storage unit test in .fast These tests depend on assertions being triggered, which does not happen in .fast. Change-Id: I0dd78f184809a453035046bc76640dfb5988bb5f Signed-off-by: Daniel R. Carvalho --- M src/base/stats/storage.test.cc 1 file changed, 8 insertions(+), 0 deletions(-) diff --git a/src/base/stats/storage.test.cc b/src/base/stats/storage.test.cc index 78df23d..3218438 100644 --- a/src/base/stats/storage.test.cc +++ b/src/base/stats/storage.test.cc @@ -175,6 +175,7 @@ increaseTick(); } +#if TRACING_ON /** * Test whether getting the result in a different tick triggers an assertion. */ @@ -184,6 +185,7 @@ increaseTick(); ASSERT_DEATH(stor.result(), ".+"); } +#endif /** * Test whether getting the result in a different tick does not trigger an @@ -266,6 +268,7 @@ ASSERT_FALSE(stor.zero()); } +#if TRACING_ON /** Test that an assertion is thrown when bucket size is 0. */ TEST(StatsDistStorDeathTest, BucketSize0) { @@ -273,6 +276,7 @@ EXPECT_ANY_THROW(Stats::DistStor::Params params(0, 5, 0)); testing::internal::GetCapturedStderr(); } +#endif /** * Test whether zero is correctly set as the reset value. The test order is @@ -492,6 +496,7 @@ checkExpectedDistData(data, expected_data, true); } +#if TRACING_ON /** Test that an assertion is thrown when not enough buckets are provided. */ TEST(StatsHistStorDeathTest, NotEnoughBuckets0) { @@ -507,6 +512,7 @@ EXPECT_ANY_THROW(Stats::HistStor::Params params(1)); testing::internal::GetCapturedStderr(); } +#endif /** * Test whether zero is correctly set as the reset value. The test order is @@ -913,6 +919,7 @@ prepareCheckHistStor(params, values, 0, expected_data); } +#if TRACING_ON /** Test whether adding storages with different sizes triggers an assertion. */ TEST(StatsHistStorDeathTest, AddDifferentSize) { @@ -942,6 +949,7 @@ ASSERT_DEATH(stor.add(), ".+"); } +#endif /** Test merging two histograms. */ TEST(StatsHistStorTest, Add) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40835 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: I0dd78f184809a453035046bc76640dfb5988bb5f Gerrit-Change-Number: 40835 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: dev: Fix register bank unit test in .debug
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/40836 ) Change subject: dev: Fix register bank unit test in .debug .. dev: Fix register bank unit test in .debug The lack of definition of this static variable was throwing and undefined reference error when running scons build/X86/unittests.opt. For more info, check https://stackoverflow.com/questions/ 8016780/undefined-reference-to-static-constexpr-char Change-Id: Id736dc42a82aea871da6a53c06d89fd399d3559a Signed-off-by: Daniel R. Carvalho --- M src/dev/reg_bank.test.cc 1 file changed, 8 insertions(+), 0 deletions(-) diff --git a/src/dev/reg_bank.test.cc b/src/dev/reg_bank.test.cc index 6e655e2..f72642d 100644 --- a/src/dev/reg_bank.test.cc +++ b/src/dev/reg_bank.test.cc @@ -82,6 +82,8 @@ buf.fill(0xff); } }; +// Needed by C++14 and lower +constexpr size_t RegisterRazTest::RazSize; TEST_F(RegisterRazTest, Name) { @@ -166,6 +168,8 @@ buf.fill(0x00); } }; +// Needed by C++14 and lower +constexpr size_t RegisterRaoTest::RaoSize; TEST_F(RegisterRaoTest, Name) { @@ -252,6 +256,8 @@ 0x70, 0x80, 0x90, 0xa0, 0xb0, 0xc0} {} }; +// Needed by C++14 and lower +constexpr size_t RegisterBufTest::RegSize; TEST_F(RegisterBufTest, Name) { @@ -456,6 +462,8 @@ buf{0x1, 0x2, 0x3, 0x4, 0x5, 0x6} {} }; +// Needed by C++14 and lower +constexpr size_t TypedRegisterTest::RegSize; TEST_F(TypedRegisterTest, DefaultConstructor) { -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40836 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: Id736dc42a82aea871da6a53c06d89fd399d3559a Gerrit-Change-Number: 40836 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Initialize storage params on constructor
*/ TEST(StatsHistStorTest, SamplePrepareSingleGrowUp) { -Stats::HistStor::Params params; -params.buckets = 4; +Stats::HistStor::Params params(4); // Setup expected data for the hand-carved values given. Since there // are four buckets, and the highest value is 4, the bucket size will @@ -710,8 +670,7 @@ */ TEST(StatsHistStorTest, SamplePrepareMultipleGrowUp) { -Stats::HistStor::Params params; -params.buckets = 4; +Stats::HistStor::Params params(4); // Setup expected data for the hand-carved values given. Since there // are four buckets, and the highest value is 4, the bucket size will @@ -741,8 +700,7 @@ */ TEST(StatsHistStorTest, SamplePrepareGrowDownOddBuckets) { -Stats::HistStor::Params params; -params.buckets = 5; +Stats::HistStor::Params params(5); // Setup expected data for the hand-carved values given. Since there // is a negative value, the min bucket will change, and the bucket size @@ -774,8 +732,7 @@ */ TEST(StatsHistStorTest, SamplePrepareGrowDownEvenBuckets) { -Stats::HistStor::Params params; -params.buckets = 4; +Stats::HistStor::Params params(4); // Setup expected data for the hand-carved values given. Since there // is a negative value, the min bucket will change, and the bucket size @@ -805,8 +762,7 @@ */ TEST(StatsHistStorTest, SamplePrepareGrowDownGrowOutOddBuckets) { -Stats::HistStor::Params params; -params.buckets = 5; +Stats::HistStor::Params params(5); // Setup expected data for the hand-carved values given. Since there // is a negative value, the min bucket will change, and the bucket size @@ -838,8 +794,7 @@ */ TEST(StatsHistStorTest, SamplePrepareGrowDownGrowOutEvenBuckets) { -Stats::HistStor::Params params; -params.buckets = 4; +Stats::HistStor::Params params(4); // Setup expected data for the hand-carved values given. Since there // is a negative value, the min bucket will change, and the bucket size @@ -870,8 +825,7 @@ */ TEST(StatsHistStorTest, SamplePrepareMultipleGrowOddBuckets) { -Stats::HistStor::Params params; -params.buckets = 5; +Stats::HistStor::Params params(5); // Setup expected data for the hand-carved values given. This adds quite // a few positive and negative samples, and the bucket size will grow to @@ -904,8 +858,7 @@ */ TEST(StatsHistStorTest, SamplePrepareMultipleGrowEvenBuckets) { -Stats::HistStor::Params params; -params.buckets = 4; +Stats::HistStor::Params params(4); // Setup expected data for the hand-carved values given. This adds quite // a few positive and negative samples, and the bucket size will grow to @@ -932,8 +885,7 @@ /** Test resetting storage. */ TEST(StatsHistStorTest, Reset) { -Stats::HistStor::Params params; -params.buckets = 4; +Stats::HistStor::Params params(4); MockInfo info(); Stats::HistStor stor(); @@ -964,13 +916,11 @@ /** Test whether adding storages with different sizes triggers an assertion. */ TEST(StatsHistStorDeathTest, AddDifferentSize) { -Stats::HistStor::Params params; -params.buckets = 4; +Stats::HistStor::Params params(4); MockInfo info(); Stats::HistStor stor(); -Stats::HistStor::Params params2; -params2.buckets = 5; +Stats::HistStor::Params params2(5); MockInfo info2(); Stats::HistStor stor2(); @@ -980,15 +930,13 @@ /** Test whether adding storages with different min triggers an assertion. */ TEST(StatsHistStorDeathTest, AddDifferentMin) { -Stats::HistStor::Params params; -params.buckets = 4; +Stats::HistStor::Params params(4); MockInfo info(); Stats::HistStor stor(); stor.sample(-1, 3); // On creation, the storage's min is zero -Stats::HistStor::Params params2; -params2.buckets = 4; +Stats::HistStor::Params params2(4); MockInfo info2(); Stats::HistStor stor2(); @@ -998,8 +946,7 @@ /** Test merging two histograms. */ TEST(StatsHistStorTest, Add) { -Stats::HistStor::Params params; -params.buckets = 4; +Stats::HistStor::Params params(4); MockInfo info(); // Setup first storage. Buckets are: The change was submitted with unreviewed changes in the following files: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/25426 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: I66a902cd5a7c809d3ac5be65b406de29fc0acf1c Gerrit-Change-Number: 25426 Gerrit-PatchSet: 15 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Alexandru Duțu Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Fix storage params safe_cast
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/40555 ) Change subject: base: Fix storage params safe_cast .. base: Fix storage params safe_cast Although they provide the exact same behavior, the params created in the tests did not have the type expected by the internal safe cast. The following error was triggered: storage.test.debug: build/NULL/base/cast.hh:47: T safe_cast(U) [with T = const Stats::SampleStor::Params*; U = const Stats::StorageParams*]: Assertion `ret' failed. Change-Id: I4f2ba51f3ccdb44589e61f235997245e7d9bf3c9 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40555 Tested-by: kokoro Reviewed-by: Bobby R. Bruce Maintainer: Bobby R. Bruce --- M src/base/stats/storage.test.cc 1 file changed, 4 insertions(+), 4 deletions(-) Approvals: Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/base/stats/storage.test.cc b/src/base/stats/storage.test.cc index 717c881..8a4f6ed 100644 --- a/src/base/stats/storage.test.cc +++ b/src/base/stats/storage.test.cc @@ -1083,7 +1083,7 @@ Stats::Counter val; Stats::DistData data; Stats::DistData expected_data; -Stats::DistParams params(Stats::Deviation); +Stats::SampleStor::Params params; MockInfo info(); // Simple test with one value being sampled @@ -1133,7 +1133,7 @@ Stats::Counter val = 10; Stats::Counter num_samples = 5; Stats::DistData data; -Stats::DistParams params(Stats::Deviation); +Stats::SampleStor::Params params; MockInfo info(); ASSERT_EQ(stor.size(), 1); @@ -1177,7 +1177,7 @@ Stats::Counter val; Stats::DistData data; Stats::DistData expected_data; -Stats::DistParams params(Stats::Deviation); +Stats::AvgSampleStor::Params params; MockInfo info(); // Simple test with one value being sampled @@ -1228,7 +1228,7 @@ Stats::Counter val = 10; Stats::Counter num_samples = 5; Stats::DistData data; -Stats::DistParams params(Stats::Deviation); +Stats::AvgSampleStor::Params params; MockInfo info(); ASSERT_EQ(stor.size(), 1); The change was submitted with unreviewed changes in the following files: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40555 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: I4f2ba51f3ccdb44589e61f235997245e7d9bf3c9 Gerrit-Change-Number: 40555 Gerrit-PatchSet: 3 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Fix copyright of base/stats/SConscript
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/40755 ) Change subject: base: Fix copyright of base/stats/SConscript .. base: Fix copyright of base/stats/SConscript The original copyright was accidentally removed by e59557af500d1633b1f41b023d6c072acaf145a0. Change-Id: Ib3b7a34ea889fbd9a6f2a8e21a6bb24432939da9 Signed-off-by: Daniel R. Carvalho --- M src/base/stats/SConscript 1 file changed, 1 insertion(+), 0 deletions(-) diff --git a/src/base/stats/SConscript b/src/base/stats/SConscript index 69ac275..8f037ba 100644 --- a/src/base/stats/SConscript +++ b/src/base/stats/SConscript @@ -1,6 +1,7 @@ # -*- mode:python -*- # # Copyright (c) 2021 Daniel R. Carvalho +# Copyright (c) 2006 The Regents of The University of Michigan # All rights reserved. # # Redistribution and use in source and binary forms, with or without -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40755 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: Ib3b7a34ea889fbd9a6f2a8e21a6bb24432939da9 Gerrit-Change-Number: 40755 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Make read-only functions const in ScalarBase
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/27084 ) Change subject: base: Make read-only functions const in ScalarBase .. base: Make read-only functions const in ScalarBase These functions do not need to modify their storage's contents. ScalarBase's non-const value() has been removed. Change-Id: I4dd3899a29a741a7d8cd199ccd254b346d86ae07 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27084 Tested-by: kokoro Reviewed-by: Bobby R. Bruce Maintainer: Bobby R. Bruce --- M src/base/statistics.hh 1 file changed, 8 insertions(+), 11 deletions(-) Approvals: Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/base/statistics.hh b/src/base/statistics.hh index 1c3d53d..b1f27c7 100644 --- a/src/base/statistics.hh +++ b/src/base/statistics.hh @@ -523,13 +523,6 @@ } public: -/** - * Return the current value of this stat as its base type. - * @return The current value. - */ -Counter value() const { return data()->value(); } - - public: ScalarBase(Group *parent = nullptr, const char *name = nullptr, const char *desc = nullptr) : DataWrap(parent, name, desc) @@ -585,13 +578,17 @@ */ size_type size() const { return 1; } -Counter value() { return data()->value(); } +/** + * Return the current value of this stat as its base type. + * @return The current value. + */ +Counter value() const { return data()->value(); } -Result result() { return data()->result(); } +Result result() const { return data()->result(); } -Result total() { return result(); } +Result total() const { return result(); } -bool zero() { return result() == 0.0; } +bool zero() const { return result() == 0.0; } void reset() { data()->reset(this->info()); } void prepare() { data()->prepare(this->info()); } 4 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/+/27084 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: I4dd3899a29a741a7d8cd199ccd254b346d86ae07 Gerrit-Change-Number: 27084 Gerrit-PatchSet: 13 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Gem5 Cloud Project GCB service account <345032938...@cloudbuild.gserviceaccount.com> Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Fix storage params safe_cast
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/40555 ) Change subject: base: Fix storage params safe_cast .. base: Fix storage params safe_cast Although they provide the exact same behavior, the params created in the tests did not have the type expected by the internal safe cast. The following error was triggered: storage.test.debug: build/NULL/base/cast.hh:47: T safe_cast(U) [with T = const Stats::SampleStor::Params*; U = const Stats::StorageParams*]: Assertion `ret' failed. Change-Id: I4f2ba51f3ccdb44589e61f235997245e7d9bf3c9 Signed-off-by: Daniel R. Carvalho --- M src/base/stats/storage.test.cc 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/base/stats/storage.test.cc b/src/base/stats/storage.test.cc index 717c881..8a4f6ed 100644 --- a/src/base/stats/storage.test.cc +++ b/src/base/stats/storage.test.cc @@ -1083,7 +1083,7 @@ Stats::Counter val; Stats::DistData data; Stats::DistData expected_data; -Stats::DistParams params(Stats::Deviation); +Stats::SampleStor::Params params; MockInfo info(); // Simple test with one value being sampled @@ -1133,7 +1133,7 @@ Stats::Counter val = 10; Stats::Counter num_samples = 5; Stats::DistData data; -Stats::DistParams params(Stats::Deviation); +Stats::SampleStor::Params params; MockInfo info(); ASSERT_EQ(stor.size(), 1); @@ -1177,7 +1177,7 @@ Stats::Counter val; Stats::DistData data; Stats::DistData expected_data; -Stats::DistParams params(Stats::Deviation); +Stats::AvgSampleStor::Params params; MockInfo info(); // Simple test with one value being sampled @@ -1228,7 +1228,7 @@ Stats::Counter val = 10; Stats::Counter num_samples = 5; Stats::DistData data; -Stats::DistParams params(Stats::Deviation); +Stats::AvgSampleStor::Params params; MockInfo info(); ASSERT_EQ(stor.size(), 1); -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40555 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: I4f2ba51f3ccdb44589e61f235997245e7d9bf3c9 Gerrit-Change-Number: 40555 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: scons: Add an "All" compound debug flag
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/39077 ) Change subject: scons: Add an "All" compound debug flag .. scons: Add an "All" compound debug flag Add an "All" compound debug flag, which encapsulates all debug flags. Since this is the broadest compound flag, allowing users to include it would imply in extremely generic includes. Moreover, it is highly unlikely that any correct C++ code would ever use all debug flags. Therefore, a header file for this flag is not generated to force users to directly include only the debug flags they need. Change-Id: If40f2f708be1495fa2b2380266164d5d44d7cffa Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39077 Tested-by: kokoro Reviewed-by: Nathanael Premillieu Maintainer: Bobby R. Bruce --- M src/SConscript M src/python/m5/debug.py 2 files changed, 20 insertions(+), 1 deletion(-) Approvals: Nathanael Premillieu: Looks good to me, approved Bobby R. Bruce: Looks good to me, approved kokoro: Regressions pass diff --git a/src/SConscript b/src/SConscript index 6637b1f..81a1b4d 100644 --- a/src/SConscript +++ b/src/SConscript @@ -633,6 +633,19 @@ def DebugFormatFlag(name, desc=None): DebugFlag(name, desc, True) +# Create a compound debug flag that encapsulates all flags: "All". This +# flag should not be used within C++ code - it is a compound meta flag +def _createAllDebugFlag(): +simple_flags = [] +for name,flag in sorted(debug_flags.items()): +n, compound, desc, fmt = flag +assert n == name +if not compound and not fmt: +simple_flags.append(n) + +CompoundFlag("All", simple_flags, +"Controls all debug flags. It should not be used within C++ code.") + Export('DebugFlag') Export('CompoundFlag') Export('DebugFormatFlag') @@ -1174,6 +1187,8 @@ code.write(str(target[0])) +# Generate the files for the debug and debug-format flags +_createAllDebugFlag() for name,flag in sorted(debug_flags.items()): n, compound, desc, fmt = flag assert n == name diff --git a/src/python/m5/debug.py b/src/python/m5/debug.py index fbcb624..d808850 100644 --- a/src/python/m5/debug.py +++ b/src/python/m5/debug.py @@ -43,7 +43,11 @@ for name, flag in filter(lambda kv: isinstance(kv[1], CompoundFlag), sorted_flags): print("%s: %s" % (name, flag.desc)) -printList([ c.name for c in flag.kids() ], indent=8) +# The list of kids for flag "All" is too long, so it is not printed +if name != "All": +printList([ c.name for c in flag.kids() ], indent=8) +else: +print("All Base Flags") print() print("Formatting Flags:") for name, flag in filter(lambda kv: isinstance(kv[1], SimpleFlag) The change was submitted with unreviewed changes in the following files: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39077 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: If40f2f708be1495fa2b2380266164d5d44d7cffa Gerrit-Change-Number: 39077 Gerrit-PatchSet: 7 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Nathanael Premillieu Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Move Stats::Info functions to its own source file
se/stats/info.hh index ad34b39..d9a6654 100644 --- a/src/base/stats/info.hh +++ b/src/base/stats/info.hh @@ -255,6 +255,9 @@ SparseHistData data; }; +typedef std::map NameMapType; +NameMapType (); + } // namespace Stats #endif // __BASE_STATS_INFO_HH__ -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/25424 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: I1e5e828c7814748c2582755f664550241caf860e Gerrit-Change-Number: 25424 Gerrit-PatchSet: 12 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Alexandru Duțu Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sim: Move cur tick to its own files
distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __SIM_CUR_TICK_HH__ +#define __SIM_CUR_TICK_HH__ + +#include "base/types.hh" + +namespace Gem5Internal +{ + +// This pointer is maintained by curEventQueue in src/sim/eventq.hh. +extern __thread Tick *_curTickPtr; + +} // namespace Gem5Internal + +/// The universal simulation clock. +inline Tick curTick() { return *Gem5Internal::_curTickPtr; } + +#endif /* __SIM_CUR_TICK_HH__ */ The change was submitted with unreviewed changes in the following files: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39835 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: Ib4348312afb90765edb4f94c80785df1275b2004 Gerrit-Change-Number: 39835 Gerrit-PatchSet: 5 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-CC: Gabe Black Gerrit-CC: Giacomo Travaglini Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base,tests: Add a basic fake class to handle curTick
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/39836 ) Change subject: base,tests: Add a basic fake class to handle curTick .. base,tests: Add a basic fake class to handle curTick Add this basic fake class that handles the initialization and update of the current tick. Change-Id: Iba8ecc049acdd097caa4d9cf05ac8d78bbaf03cc Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39836 Reviewed-by: Giacomo Travaglini Maintainer: Giacomo Travaglini Tested-by: kokoro --- A src/base/gtest/cur_tick_fake.hh 1 file changed, 48 insertions(+), 0 deletions(-) Approvals: Giacomo Travaglini: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/base/gtest/cur_tick_fake.hh b/src/base/gtest/cur_tick_fake.hh new file mode 100644 index 000..5afe2a3 --- /dev/null +++ b/src/base/gtest/cur_tick_fake.hh @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Daniel R. Carvalho + * 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 + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "base/types.hh" +#include "sim/cur_tick.hh" + +namespace { + +class GTestTickHandler +{ + public: +GTestTickHandler() +{ +if (Gem5Internal::_curTickPtr == nullptr) { +Gem5Internal::_curTickPtr = new Tick(0); +} +} + +/** Assign a value to the current simulation tick. */ +void setCurTick(Tick tick) { *Gem5Internal::_curTickPtr = tick; } +}; + +} // anonymous namespace The change was submitted with unreviewed changes in the following files: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39836 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: Iba8ecc049acdd097caa4d9cf05ac8d78bbaf03cc Gerrit-Change-Number: 39836 Gerrit-PatchSet: 5 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Giacomo Travaglini Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: scons: Separate debug flags from debug-format flags
ide { _tracing = _globalEnable && _enabled; } public: -SimpleFlag(const char *name, const char *desc) : Flag(name, desc) {} +SimpleFlag(const char *name, const char *desc, bool is_format=false) + : Flag(name, desc), _isFormat(is_format) +{} bool enabled() const override { return _tracing; } void enable() override { _enabled = true; sync(); } void disable() override { _enabled = false; sync(); } + +/** + * Checks whether this flag is a conventional debug flag, or a flag that + * modifies the way debug information is printed. + * + * @return True if this flag is a debug-formatting flag. + */ +bool isFormat() const { return _isFormat; } }; class CompoundFlag : public Flag diff --git a/src/base/debug.test.cc b/src/base/debug.test.cc index 3f7b2f4..f995a33 100644 --- a/src/base/debug.test.cc +++ b/src/base/debug.test.cc @@ -60,6 +60,17 @@ EXPECT_EQ(expected, actual); } +/** Test format attribute. */ +TEST(DebugFlagTest, IsFormat) +{ +Debug::SimpleFlag flag_a("FlagIsFormatTestA", "", true); +EXPECT_TRUE(flag_a.isFormat()); +Debug::SimpleFlag flag_b("FlagIsFormatTestB", "", false); +EXPECT_FALSE(flag_b.isFormat()); +Debug::SimpleFlag flag_c("FlagIsFormatTestC", ""); +EXPECT_FALSE(flag_c.isFormat()); +} + /** Test enabling and disabling simple flags, as well as the global enabler. */ TEST(DebugSimpleFlagTest, Enabled) { diff --git a/src/python/m5/debug.py b/src/python/m5/debug.py index 10d0980..fbcb624 100644 --- a/src/python/m5/debug.py +++ b/src/python/m5/debug.py @@ -35,8 +35,8 @@ sorted_flags = sorted(flags.items(), key=lambda kv: kv[0]) print("Base Flags:") -for name, flag in filter(lambda kv: not isinstance(kv[1], CompoundFlag), - sorted_flags): +for name, flag in filter(lambda kv: isinstance(kv[1], SimpleFlag) + and not kv[1].isFormat, sorted_flags): print("%s: %s" % (name, flag.desc)) print() print("Compound Flags:") @@ -45,6 +45,11 @@ print("%s: %s" % (name, flag.desc)) printList([ c.name for c in flag.kids() ], indent=8) print() +print("Formatting Flags:") +for name, flag in filter(lambda kv: isinstance(kv[1], SimpleFlag) + and kv[1].isFormat, sorted_flags): +print("%s: %s" % (name, flag.desc)) +print() class AllFlags(Mapping): def __init__(self): diff --git a/src/python/pybind11/debug.cc b/src/python/pybind11/debug.cc index 6ee2655..a2b5406 100644 --- a/src/python/pybind11/debug.cc +++ b/src/python/pybind11/debug.cc @@ -110,7 +110,9 @@ }) ; -py::class_(m_debug, "SimpleFlag", c_flag); +py::class_(m_debug, "SimpleFlag", c_flag) +.def_property_readonly("isFormat", ::SimpleFlag::isFormat) +; py::class_(m_debug, "CompoundFlag", c_flag) .def("kids", ::CompoundFlag::kids) ; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39076 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: Ieae68745276218cf4e9c1d37d7bf3bd1f19709ae Gerrit-Change-Number: 39076 Gerrit-PatchSet: 5 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Ciro Santilli Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Nathanael Premillieu Gerrit-Reviewer: kokoro Gerrit-CC: Andreas Sandberg Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sim: Move cur tick to its own files
BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __SIM_CUR_TICK_HH__ +#define __SIM_CUR_TICK_HH__ + +#include "base/types.hh" + +namespace Gem5Internal +{ + +// This pointer is maintained by curEventQueue in src/sim/eventq.hh. +extern __thread Tick *_curTickPtr; + +} // namespace Gem5Internal + +/// The universal simulation clock. +inline Tick curTick() { return *Gem5Internal::_curTickPtr; } + +#endif /* __SIM_CUR_TICK_HH__ */ -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39835 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: Ib4348312afb90765edb4f94c80785df1275b2004 Gerrit-Change-Number: 39835 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base,tests: Add a basic mock class to handle curTick
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/39836 ) Change subject: base,tests: Add a basic mock class to handle curTick .. base,tests: Add a basic mock class to handle curTick Add this basic mock class that handles the initialization and update of the current tick. Change-Id: Iba8ecc049acdd097caa4d9cf05ac8d78bbaf03cc Signed-off-by: Daniel R. Carvalho --- A src/base/gtest/cur_tick_mock.hh 1 file changed, 48 insertions(+), 0 deletions(-) diff --git a/src/base/gtest/cur_tick_mock.hh b/src/base/gtest/cur_tick_mock.hh new file mode 100644 index 000..5afe2a3 --- /dev/null +++ b/src/base/gtest/cur_tick_mock.hh @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Daniel R. Carvalho + * 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 + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "base/types.hh" +#include "sim/cur_tick.hh" + +namespace { + +class GTestTickHandler +{ + public: +GTestTickHandler() +{ +if (Gem5Internal::_curTickPtr == nullptr) { +Gem5Internal::_curTickPtr = new Tick(0); +} +} + +/** Assign a value to the current simulation tick. */ +void setCurTick(Tick tick) { *Gem5Internal::_curTickPtr = tick; } +}; + +} // anonymous namespace -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39836 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: Iba8ecc049acdd097caa4d9cf05ac8d78bbaf03cc Gerrit-Change-Number: 39836 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Rename Flags::update as Flags::replace
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/38737 ) Change subject: base: Rename Flags::update as Flags::replace .. base: Rename Flags::update as Flags::replace The function name `update` is too generic. Given that the expected functionality is to replace the selected flag bits with the bits provided as parameters, rename it as `replace`. Change-Id: Ic7613ae09ecf9b92e31103b4e928192c07e9b640 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38737 Tested-by: kokoro Reviewed-by: Jason Lowe-Power Maintainer: Bobby R. Bruce --- M src/base/flags.hh M src/base/flags.test.cc 2 files changed, 4 insertions(+), 4 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved Bobby R. Bruce: Looks good to me, approved kokoro: Regressions pass diff --git a/src/base/flags.hh b/src/base/flags.hh index 6e82210..0544380 100644 --- a/src/base/flags.hh +++ b/src/base/flags.hh @@ -135,7 +135,7 @@ * @param mask Mask used to determine which bits are replaced. */ void -update(Type flags, Type mask) +replace(Type flags, Type mask) { _flags = (_flags & ~mask) | (flags & mask); } diff --git a/src/base/flags.test.cc b/src/base/flags.test.cc index c45a7a8..08031b9 100644 --- a/src/base/flags.test.cc +++ b/src/base/flags.test.cc @@ -192,11 +192,11 @@ } /** - * Test updating a masked selection of bits. This means that bits of the + * Test replacing a masked selection of bits. This means that bits of the * original value that match the mask will be replaced by the bits of * the new value that match the mask. */ -TEST(FlagsTest, UpdateOverlapping) +TEST(FlagsTest, ReplaceOverlapping) { const uint32_t value_a = (1 << 4) | (1 << 5) | (1 << 6); const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9); @@ -207,6 +207,6 @@ // (1 << 10) is not set in both values, so it remains not set const uint32_t result = (1 << 5) | (1 << 6) | (1 << 9); Flags flags(value_a); -flags.update(value_b, mask); +flags.replace(value_b, mask); ASSERT_EQ(result, uint32_t(flags)); } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38737 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: Ic7613ae09ecf9b92e31103b4e928192c07e9b640 Gerrit-Change-Number: 38737 Gerrit-PatchSet: 6 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Add unit tests for flags.hh
sSetAny) +{ +const uint32_t value = (1 << 3); +const Flags flags_a; +const Flags flags_b(value); +ASSERT_FALSE(flags_a.isSet()); +ASSERT_TRUE(flags_b.isSet()); +} + +/** Test isSet for multiple bits set. */ +TEST(FlagsTest, IsSetValue) +{ +const uint32_t value_a = (1 << 3); +const uint32_t value_b = (1 << 5); +const Flags flags(value_a | value_b); +ASSERT_TRUE(flags.isSet(value_a)); +ASSERT_FALSE(flags.isSet(value_a << 1)); +ASSERT_TRUE(flags.isSet(value_b)); +} + +/** Test isSet comparing against another flag. */ +TEST(FlagsTest, IsSetType) +{ +const uint32_t value_a = (1 << 5) | (1 << 6); +const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9); +const uint32_t value_c = (1 << 4) | (1 << 8); +const Flags flags(value_a); +ASSERT_TRUE(flags.isSet(value_b)); +ASSERT_FALSE(flags.isSet(value_c)); +} + +/** Test if all bits are set with allSet. */ +TEST(FlagsTest, AllSet) +{ +const uint32_t value_b = (1 << 5) | (1 << 6); +const uint32_t value_c = std::numeric_limits::max(); +const Flags flags_a; +const Flags flags_b(value_b); +const Flags flags_c(value_c); +ASSERT_FALSE(flags_a.allSet()); +ASSERT_FALSE(flags_b.allSet()); +ASSERT_TRUE(flags_c.allSet()); +} + +/** Test allSet comparing against another flag. */ +TEST(FlagsTest, AllSetMatch) +{ +const uint32_t value_a = (1 << 5) | (1 << 6); +const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9); +const Flags flags(value_a); +ASSERT_TRUE(flags.allSet(value_a)); +ASSERT_FALSE(flags.allSet(value_b)); +} + +/** Test if no bits are set with noneSet. */ +TEST(FlagsTest, NoneSet) +{ +const uint32_t value_b = (1 << 5) | (1 << 6); +const Flags flags_a; +const Flags flags_b(value_b); +ASSERT_TRUE(flags_a.noneSet()); +ASSERT_FALSE(flags_b.noneSet()); +} + +/** Test noneSet comparing against another flag. */ +TEST(FlagsTest, NoneSetMatch) +{ +const uint32_t value_a = (1 << 5) | (1 << 6); +const uint32_t value_b = (1 << 3) | (1 << 6); +const uint32_t value_c = (1 << 3) | (1 << 4) | (1 << 9); +const Flags flags(value_a); +ASSERT_FALSE(flags.noneSet(value_a)); +ASSERT_FALSE(flags.noneSet(value_b)); +ASSERT_TRUE(flags.noneSet(value_c)); +} + +/** Test if no bits are set after a full clear. */ +TEST(FlagsTest, Clear) +{ +const uint32_t value = (1 << 5) | (1 << 6); +Flags flags(value); +flags.clear(); +ASSERT_TRUE(flags.noneSet()); +} + +/** Test clearing specific bits. */ +TEST(FlagsTest, ClearMatch) +{ +const uint32_t value_a = (1 << 5) | (1 << 6); +const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9); +Flags flags(value_a); +flags.clear(value_b); +ASSERT_FALSE(flags.isSet(value_a & value_b)); +ASSERT_TRUE(flags.isSet(value_a ^ (value_a & value_b))); +} + +/** Test setting with a few overlapping bits. */ +TEST(FlagsTest, SetOverlapping) +{ +const uint32_t value_a = (1 << 5) | (1 << 6); +const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9); +Flags flags(value_a); +flags.set(value_b); +ASSERT_EQ(value_a | value_b, uint32_t(flags)); +} + +/** + * Test conditional set. If true the selected bits are set; otherwise, they + * are cleared. + */ +TEST(FlagsTest, ConditionalSet) +{ +const uint32_t value_a = (1 << 5) | (1 << 6); +const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9); + +Flags flags_true(value_a); +flags_true.set(value_b, true); +ASSERT_EQ(value_a | value_b, uint32_t(flags_true)); + +Flags flags_false(value_a); +flags_false.set(value_b, false); +ASSERT_EQ(value_a & ~value_b, uint32_t(flags_false)); +} + +/** + * Test updating a masked selection of bits. This means that bits of the + * original value that match the mask will be replaced by the bits of + * the new value that match the mask. + */ +TEST(FlagsTest, UpdateOverlapping) +{ +const uint32_t value_a = (1 << 4) | (1 << 5) | (1 << 6); +const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9); +const uint32_t mask = (1 << 4) | (1 << 5) | (1 << 9) | (1 << 10); +// (1 << 4) is set in value_a, but is not set in value_b, so it is cleared +// (1 << 5) is set in both values, so it remains set +// (1 << 9) is not set in value_a, but it is in value_b, so it is set +// (1 << 10) is not set in both values, so it remains not set +const uint32_t result = (1 << 5) | (1 << 6) | (1 << 9); +Flags flags(value_a); +flags.update(value_b, mask); +ASSERT_EQ(result, uint32_t(flags)); +} -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38714 To uns
[gem5-dev] Change in gem5/gem5[develop]: base: Remove dubious/unused Flags functions
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/38736 ) Change subject: base: Remove dubious/unused Flags functions .. base: Remove dubious/unused Flags functions The functions isSet(), noneSet(), and allSet() assume that all bits of the underlying container have a corresponding flag. This is typically not true, and the likelihood of incorrectly using these functions is high. Fortunately these functions are not being used anywhere, and can be safely removed. Alternatively, a mask could be provided on construction to determine which bits of the underlying container correspond to a flag bit, so that the proper bits are checked in these functions. Change-Id: Ia7cbfd0726943506a3f04dc417e67a0b57cdbf95 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38736 Maintainer: Bobby R. Bruce Tested-by: kokoro Reviewed-by: Jason Lowe-Power Reviewed-by: Bobby R. Bruce --- M src/base/flags.hh M src/base/flags.test.cc 2 files changed, 1 insertion(+), 55 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/base/flags.hh b/src/base/flags.hh index 170abc5..6e82210 100644 --- a/src/base/flags.hh +++ b/src/base/flags.hh @@ -72,13 +72,6 @@ } /** - * Verifies whether any bit in the flags is set. - * - * @return True if any flag bit is set; false otherwise. - */ -bool isSet() const { return _flags; } - -/** * Verifies whether any bit matching the given mask is set. * * @param mask The mask containing the bits to verify. @@ -87,13 +80,6 @@ bool isSet(Type mask) const { return (_flags & mask); } /** - * Verifies whether all bits in the flags are set. - * - * @return True if all flag bits are set; false otherwise. - */ -bool allSet() const { return !(~_flags); } - -/** * Verifies whether no bits matching the given mask are set. * * @param mask The mask containing the bits to verify. @@ -102,13 +88,6 @@ bool allSet(Type mask) const { return (_flags & mask) == mask; } /** - * Verifies whether no bits in the flags are set. - * - * @return True if all flag bits are cleared; false otherwise. - */ -bool noneSet() const { return _flags == 0; } - -/** * Verifies whether no bits matching the given mask are set. * * @param mask The mask containing the bits to verify. diff --git a/src/base/flags.test.cc b/src/base/flags.test.cc index 297abc8..c45a7a8 100644 --- a/src/base/flags.test.cc +++ b/src/base/flags.test.cc @@ -99,16 +99,6 @@ ASSERT_EQ(uint32_t(flags_a), uint32_t(flags_b)); } -/** Test isSet for any bit set. */ -TEST(FlagsTest, IsSetAny) -{ -const uint32_t value = (1 << 3); -const Flags flags_a; -const Flags flags_b(value); -ASSERT_FALSE(flags_a.isSet()); -ASSERT_TRUE(flags_b.isSet()); -} - /** Test isSet for multiple bits set. */ TEST(FlagsTest, IsSetValue) { @@ -131,19 +121,6 @@ ASSERT_FALSE(flags.isSet(value_c)); } -/** Test if all bits are set with allSet. */ -TEST(FlagsTest, AllSet) -{ -const uint32_t value_b = (1 << 5) | (1 << 6); -const uint32_t value_c = std::numeric_limits::max(); -const Flags flags_a; -const Flags flags_b(value_b); -const Flags flags_c(value_c); -ASSERT_FALSE(flags_a.allSet()); -ASSERT_FALSE(flags_b.allSet()); -ASSERT_TRUE(flags_c.allSet()); -} - /** Test allSet comparing against another flag. */ TEST(FlagsTest, AllSetMatch) { @@ -154,16 +131,6 @@ ASSERT_FALSE(flags.allSet(value_b)); } -/** Test if no bits are set with noneSet. */ -TEST(FlagsTest, NoneSet) -{ -const uint32_t value_b = (1 << 5) | (1 << 6); -const Flags flags_a; -const Flags flags_b(value_b); -ASSERT_TRUE(flags_a.noneSet()); -ASSERT_FALSE(flags_b.noneSet()); -} - /** Test noneSet comparing against another flag. */ TEST(FlagsTest, NoneSetMatch) { @@ -182,7 +149,7 @@ const uint32_t value = (1 << 5) | (1 << 6); Flags flags(value); flags.clear(); -ASSERT_TRUE(flags.noneSet()); +ASSERT_EQ(0, uint32_t(flags)); } /** Test clearing specific bits. */ -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38736 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: Ia7cbfd0726943506a3f04dc417e67a0b57cdbf95 Gerrit-Change-Number: 38736 Gerrit-PatchSet: 6 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged
[gem5-dev] Change in gem5/gem5[develop]: misc: Fix some includes
c/mem/physical.cc @@ -54,6 +54,7 @@ #include "debug/AddrRanges.hh" #include "debug/Checkpoint.hh" #include "mem/abstract_mem.hh" +#include "sim/serialize.hh" /** * On Linux, MAP_NORESERVE allow us to simulate a very large memory diff --git a/src/mem/ruby/network/simple/PerfectSwitch.cc b/src/mem/ruby/network/simple/PerfectSwitch.cc index 156b96d..432b6d6 100644 --- a/src/mem/ruby/network/simple/PerfectSwitch.cc +++ b/src/mem/ruby/network/simple/PerfectSwitch.cc @@ -31,6 +31,7 @@ #include #include "base/cast.hh" +#include "base/cprintf.hh" #include "base/random.hh" #include "debug/RubyNetwork.hh" #include "mem/ruby/network/MessageBuffer.hh" diff --git a/src/sim/clock_domain.cc b/src/sim/clock_domain.cc index 61d5654..f27a8f3 100644 --- a/src/sim/clock_domain.cc +++ b/src/sim/clock_domain.cc @@ -41,12 +41,14 @@ #include #include +#include "base/logging.hh" #include "base/trace.hh" #include "debug/ClockDomain.hh" #include "params/ClockDomain.hh" #include "params/DerivedClockDomain.hh" #include "params/SrcClockDomain.hh" #include "sim/clocked_object.hh" +#include "sim/serialize.hh" #include "sim/voltage_domain.hh" ClockDomain::ClockDomainStats::ClockDomainStats(ClockDomain ) diff --git a/src/sim/dvfs_handler.cc b/src/sim/dvfs_handler.cc index 38ca35c..53b4271 100644 --- a/src/sim/dvfs_handler.cc +++ b/src/sim/dvfs_handler.cc @@ -40,12 +40,10 @@ #include #include -#include "base/logging.hh" #include "base/trace.hh" #include "debug/DVFS.hh" #include "params/DVFSHandler.hh" -#include "sim/clock_domain.hh" -#include "sim/eventq.hh" +#include "sim/serialize.hh" #include "sim/stat_control.hh" #include "sim/voltage_domain.hh" diff --git a/src/sim/dvfs_handler.hh b/src/sim/dvfs_handler.hh index da04fc5..fccaf63 100644 --- a/src/sim/dvfs_handler.hh +++ b/src/sim/dvfs_handler.hh @@ -46,8 +46,12 @@ #ifndef __SIM_DVFS_HANDLER_HH__ #define __SIM_DVFS_HANDLER_HH__ +#include +#include #include +#include "base/logging.hh" +#include "base/types.hh" #include "debug/DVFS.hh" #include "params/DVFSHandler.hh" #include "sim/clock_domain.hh" diff --git a/src/sim/eventq.hh b/src/sim/eventq.hh index 5fb0877..a9ab29b 100644 --- a/src/sim/eventq.hh +++ b/src/sim/eventq.hh @@ -40,6 +40,7 @@ #include #include #include +#include #include #include diff --git a/src/sim/power/thermal_domain.cc b/src/sim/power/thermal_domain.cc index dabf2fe..e9f4d3c 100644 --- a/src/sim/power/thermal_domain.cc +++ b/src/sim/power/thermal_domain.cc @@ -46,6 +46,7 @@ #include "sim/linear_solver.hh" #include "sim/power/thermal_model.hh" #include "sim/probe/probe.hh" +#include "sim/serialize.hh" #include "sim/sub_system.hh" ThermalDomain::ThermalDomain(const Params ) diff --git a/src/sim/power/thermal_model.cc b/src/sim/power/thermal_model.cc index 65649e5..408642c 100644 --- a/src/sim/power/thermal_model.cc +++ b/src/sim/power/thermal_model.cc @@ -44,6 +44,7 @@ #include "sim/clocked_object.hh" #include "sim/linear_solver.hh" #include "sim/power/thermal_domain.hh" +#include "sim/serialize.hh" #include "sim/sim_object.hh" /** diff --git a/src/sim/power_state.cc b/src/sim/power_state.cc index a11ed43..ffa1972 100644 --- a/src/sim/power_state.cc +++ b/src/sim/power_state.cc @@ -37,10 +37,13 @@ #include "sim/power_state.hh" +#include + #include "base/logging.hh" #include "base/trace.hh" #include "debug/PowerDomain.hh" #include "sim/power_domain.hh" +#include "sim/serialize.hh" PowerState::PowerState(const PowerStateParams ) : SimObject(p), _currState(p.default_state), diff --git a/src/sim/power_state.hh b/src/sim/power_state.hh index fe869ff..fb9a581 100644 --- a/src/sim/power_state.hh +++ b/src/sim/power_state.hh @@ -44,6 +44,7 @@ #define __SIM_POWER_STATE_HH__ #include +#include #include "base/callback.hh" #include "base/statistics.hh" diff --git a/src/sim/redirect_path.cc b/src/sim/redirect_path.cc index f270057..57286f7 100644 --- a/src/sim/redirect_path.cc +++ b/src/sim/redirect_path.cc @@ -30,6 +30,8 @@ #include +#include "base/str.hh" + static std::string normalizePath(std::string path) { diff --git a/src/sim/root.hh b/src/sim/root.hh index 817e2f3..2db4223 100644 --- a/src/sim/root.hh +++ b/src/sim/root.hh @@ -53,6 +53,7 @@ #include "base/statistics.hh" #include "base/time.hh" +#include "base/types.hh" #include "params/Root.hh" #include "sim/eventq.hh" #include "sim/sim_object.hh" diff --git a/src/sim/serialize_handlers.hh b/src/sim/serialize_handlers.hh index 8efd895..5e5c3ff 100644 --- a/src/sim/serialize_handlers.hh +++ b/src/sim/serialize_handlers.hh @@ -47,8 +47,8 @@ #include -#include #include +#include #include "base/str.hh" diff --git a/src/sim/sim_exit.hh b/src/sim/sim_exit.hh index a79d3e2..d1791f5 100644 --- a/src/sim/sim_exit.hh +++ b/src/sim/sim_exit.hh @@ -29,6 +29,7 @@ #ifndef __SIM_EXIT_HH__ #define __SIM_EXIT_HH__ +#include #include #include "base/types.hh" diff --git a/src/sim/ticked_object.cc b/src/sim/ticked_object.cc index 3564b4d..79cbd41 100644 --- a/src/sim/ticked_object.cc +++ b/src/sim/ticked_object.cc @@ -39,6 +39,7 @@ #include "params/TickedObject.hh" #include "sim/clocked_object.hh" +#include "sim/serialize.hh" Ticked::Ticked(ClockedObject _, Stats::Scalar *imported_num_cycles, diff --git a/src/sim/voltage_domain.cc b/src/sim/voltage_domain.cc index f6f8396..d770af8 100644 --- a/src/sim/voltage_domain.cc +++ b/src/sim/voltage_domain.cc @@ -39,11 +39,11 @@ #include -#include "base/statistics.hh" +#include "base/logging.hh" #include "base/trace.hh" #include "debug/VoltageDomain.hh" #include "params/VoltageDomain.hh" -#include "sim/sim_object.hh" +#include "sim/serialize.hh" VoltageDomain::VoltageDomain(const Params ) : SimObject(p), voltageOpPoints(p.voltage), _perfLevel(0), stats(*this) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38738 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: Ibf314b43a966943a8096958f68382e1e245f29e3 Gerrit-Change-Number: 38738 Gerrit-PatchSet: 5 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Add unit test for debug.hh
changeFlag("FlagChangeFlagTestB", false)); +ASSERT_FALSE(flag_b.status()); +EXPECT_TRUE(Debug::changeFlag("FlagChangeFlagTestB", true)); +ASSERT_TRUE(flag_b.status()); + +// Change a non-existent flag +ASSERT_FALSE(Debug::changeFlag("FlagChangeFlagTestC", true)); +} + +/** Test changing flag status with aux functions. */ +TEST(DebugFlagTest, SetClearDebugFlag) +{ +Debug::Flag::globalEnable(); +Debug::SimpleFlag flag_a("FlagSetClearDebugFlagTestA", ""); +Debug::SimpleFlag flag_b("FlagSetClearDebugFlagTestB", ""); + +// Enable and disable a flag +ASSERT_FALSE(flag_a.status()); +setDebugFlag("FlagSetClearDebugFlagTestA"); +ASSERT_TRUE(flag_a.status()); +clearDebugFlag("FlagSetClearDebugFlagTestA"); +ASSERT_FALSE(flag_a.status()); + +// Disable and enable a flag +ASSERT_FALSE(flag_b.status()); +clearDebugFlag("FlagSetClearDebugFlagTestB"); +ASSERT_FALSE(flag_b.status()); +setDebugFlag("FlagSetClearDebugFlagTestB"); +ASSERT_TRUE(flag_b.status()); + +// Change a non-existent flag +setDebugFlag("FlagSetClearDebugFlagTestC"); +clearDebugFlag("FlagSetClearDebugFlagTestC"); +} + +/** Test dumping no enabled debug flags. */ +TEST(DebugFlagTest, NoDumpDebugFlags) +{ +Debug::Flag::globalEnable(); +Debug::SimpleFlag flag("FlagDumpDebugFlagTest", ""); + +// Verify that the names of the enabled flags are printed +testing::internal::CaptureStdout(); +dumpDebugFlags(); +std::string output = testing::internal::GetCapturedStdout(); +EXPECT_EQ(output, ""); +ASSERT_FALSE(flag.status()); +} + +/** Test dumping enabled debug flags with a larger set of flags. */ +TEST(DebugFlagTest, DumpDebugFlags) +{ +Debug::Flag::globalEnable(); +Debug::SimpleFlag flag_a("FlagDumpDebugFlagTestA", ""); +Debug::SimpleFlag flag_b("FlagDumpDebugFlagTestB", ""); +Debug::SimpleFlag flag_c("FlagDumpDebugFlagTestC", ""); +Debug::SimpleFlag flag_d("FlagDumpDebugFlagTestD", ""); +Debug::SimpleFlag flag_e("FlagDumpDebugFlagTestE", ""); +Debug::CompoundFlag compound_flag_a("CompoundFlagDumpDebugFlagTestA", "", +{_d}); +Debug::CompoundFlag compound_flag_b("CompoundFlagDumpDebugFlagTestB", "", +{_e}); + +// Enable a few flags +ASSERT_FALSE(flag_a.status()); +ASSERT_FALSE(flag_b.status()); +ASSERT_FALSE(flag_c.status()); +ASSERT_FALSE(flag_d.status()); + ASSERT_FALSE(flag_e.status()); +flag_a.enable(); +flag_c.enable(); +compound_flag_b.enable(); + +// Verify that the names of the enabled flags are printed +testing::internal::CaptureStdout(); +dumpDebugFlags(); +std::string output = testing::internal::GetCapturedStdout(); +EXPECT_EQ(output, "FlagDumpDebugFlagTestA\nFlagDumpDebugFlagTestC\n" \ +"FlagDumpDebugFlagTestE\n"); +} -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38710 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: I1ae7318a043aa9dc479d4f970c1fd6c9946f4357 Gerrit-Change-Number: 38710 Gerrit-PatchSet: 5 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Rename Flag status to enabled
tus. */ +/** Test changing flag enabled. */ TEST(DebugFlagTest, ChangeFlag) { Debug::Flag::globalEnable(); @@ -203,24 +205,24 @@ // Enable the found flags and verify that the original flags are // enabled too -ASSERT_FALSE(flag_a.status()); +ASSERT_FALSE(flag_a.enabled()); EXPECT_TRUE(Debug::changeFlag("FlagChangeFlagTestA", true)); -ASSERT_TRUE(flag_a.status()); +ASSERT_TRUE(flag_a.enabled()); EXPECT_TRUE(Debug::changeFlag("FlagChangeFlagTestA", false)); -ASSERT_FALSE(flag_a.status()); +ASSERT_FALSE(flag_a.enabled()); // Disable and enable a flag -ASSERT_FALSE(flag_b.status()); +ASSERT_FALSE(flag_b.enabled()); EXPECT_TRUE(Debug::changeFlag("FlagChangeFlagTestB", false)); -ASSERT_FALSE(flag_b.status()); +ASSERT_FALSE(flag_b.enabled()); EXPECT_TRUE(Debug::changeFlag("FlagChangeFlagTestB", true)); -ASSERT_TRUE(flag_b.status()); +ASSERT_TRUE(flag_b.enabled()); // Change a non-existent flag ASSERT_FALSE(Debug::changeFlag("FlagChangeFlagTestC", true)); } -/** Test changing flag status with aux functions. */ +/** Test changing flag enabled with aux functions. */ TEST(DebugFlagTest, SetClearDebugFlag) { Debug::Flag::globalEnable(); @@ -228,18 +230,18 @@ Debug::SimpleFlag flag_b("FlagSetClearDebugFlagTestB", ""); // Enable and disable a flag -ASSERT_FALSE(flag_a.status()); +ASSERT_FALSE(flag_a.enabled()); setDebugFlag("FlagSetClearDebugFlagTestA"); -ASSERT_TRUE(flag_a.status()); +ASSERT_TRUE(flag_a.enabled()); clearDebugFlag("FlagSetClearDebugFlagTestA"); -ASSERT_FALSE(flag_a.status()); +ASSERT_FALSE(flag_a.enabled()); // Disable and enable a flag -ASSERT_FALSE(flag_b.status()); +ASSERT_FALSE(flag_b.enabled()); clearDebugFlag("FlagSetClearDebugFlagTestB"); -ASSERT_FALSE(flag_b.status()); +ASSERT_FALSE(flag_b.enabled()); setDebugFlag("FlagSetClearDebugFlagTestB"); -ASSERT_TRUE(flag_b.status()); +ASSERT_TRUE(flag_b.enabled()); // Change a non-existent flag setDebugFlag("FlagSetClearDebugFlagTestC"); @@ -257,7 +259,7 @@ dumpDebugFlags(); std::string output = testing::internal::GetCapturedStdout(); EXPECT_EQ(output, ""); -ASSERT_FALSE(flag.status()); +ASSERT_FALSE(flag.enabled()); } /** Test dumping enabled debug flags with a larger set of flags. */ @@ -275,11 +277,11 @@ {_e}); // Enable a few flags -ASSERT_FALSE(flag_a.status()); -ASSERT_FALSE(flag_b.status()); -ASSERT_FALSE(flag_c.status()); -ASSERT_FALSE(flag_d.status()); -ASSERT_FALSE(flag_e.status()); +ASSERT_FALSE(flag_a.enabled()); +ASSERT_FALSE(flag_b.enabled()); +ASSERT_FALSE(flag_c.enabled()); +ASSERT_FALSE(flag_d.enabled()); +ASSERT_FALSE(flag_e.enabled()); flag_a.enable(); flag_c.enable(); compound_flag_b.enable(); diff --git a/src/python/pybind11/debug.cc b/src/python/pybind11/debug.cc index 84673f1..1284d56 100644 --- a/src/python/pybind11/debug.cc +++ b/src/python/pybind11/debug.cc @@ -94,9 +94,9 @@ .def_property_readonly("desc", ::Flag::desc) .def("enable", ::Flag::enable) .def("disable", ::Flag::disable) -.def_property("status", +.def_property("enabled", [](const Debug::Flag *flag) { - return flag->status(); + return flag->enabled(); }, [](Debug::Flag *flag, bool state) { if (state) { @@ -106,7 +106,7 @@ } }) .def("__bool__", [](const Debug::Flag *flag) { -return flag->status(); +return flag->enabled(); }) ; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38711 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: I8cdd76766d80d65007a9f204abcf71b18211ab42 Gerrit-Change-Number: 38711 Gerrit-PatchSet: 5 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Andreas Sandberg Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: cpu-o3: Add missing tid in Rename's debug message
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/39075 ) Change subject: cpu-o3: Add missing tid in Rename's debug message .. cpu-o3: Add missing tid in Rename's debug message These arguments were missing. Change-Id: I8a76e46b2bcfc57f299145954fe72196f5969f29 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39075 Reviewed-by: Giacomo Travaglini Maintainer: Giacomo Travaglini Tested-by: kokoro --- M src/cpu/o3/rename_impl.hh 1 file changed, 4 insertions(+), 2 deletions(-) Approvals: Giacomo Travaglini: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/cpu/o3/rename_impl.hh b/src/cpu/o3/rename_impl.hh index 007ec87..68150f9 100644 --- a/src/cpu/o3/rename_impl.hh +++ b/src/cpu/o3/rename_impl.hh @@ -612,7 +612,8 @@ if (inst->isLoad()) { if (calcFreeLQEntries(tid) <= 0) { -DPRINTF(Rename, "[tid:%i] Cannot rename due to no free LQ\n"); +DPRINTF(Rename, "[tid:%i] Cannot rename due to no free LQ\n", +tid); source = LQ; incrFullStat(source); break; @@ -621,7 +622,8 @@ if (inst->isStore() || inst->isAtomic()) { if (calcFreeSQEntries(tid) <= 0) { -DPRINTF(Rename, "[tid:%i] Cannot rename due to no free SQ\n"); +DPRINTF(Rename, "[tid:%i] Cannot rename due to no free SQ\n", +tid); source = SQ; incrFullStat(source); break; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39075 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: I8a76e46b2bcfc57f299145954fe72196f5969f29 Gerrit-Change-Number: 39075 Gerrit-PatchSet: 2 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Giacomo Travaglini Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: scons: Add an "All" compound debug flag
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/39077 ) Change subject: scons: Add an "All" compound debug flag .. scons: Add an "All" compound debug flag Add an "All" compound debug flag, which encapsulates all debug flags. Since this is the broadest compound flag, allowing users to include it would imply in extremely generic includes. Moreover, it is highly unlikely that any correct C++ code would ever use all debug flags. Therefore, a header file for this flag is not generated to force users to directly include only the debug flags they need. Change-Id: If40f2f708be1495fa2b2380266164d5d44d7cffa Signed-off-by: Daniel R. Carvalho --- M src/SConscript 1 file changed, 12 insertions(+), 0 deletions(-) diff --git a/src/SConscript b/src/SConscript index 2533810..910df32 100644 --- a/src/SConscript +++ b/src/SConscript @@ -1176,14 +1176,26 @@ code.write(str(target[0])) +# Generate the files for the debug and debug-format flags +simple_flags = [] for name,flag in sorted(debug_flags.items()): n, compound, desc, fmt = flag assert n == name +if not compound and not fmt: +simple_flags.append(n) + hh_file = 'debug/%s.hh' % name env.Command(hh_file, Value(flag), MakeAction(makeDebugFlagHH, Transform("TRACING", 0))) +# Create a compound debug flag that encapsulates all flags: "All". This flag +# should not be used within C++ code - it is a compound meta flag; therefore, +# its header file is purposefully not generated +CompoundFlag("All", simple_flags, +"Controls all debug flags. It should not be used within C++ code.") +del simple_flags + env.Command('debug/flags.cc', Value(debug_flags), MakeAction(makeDebugFlagCC, Transform("TRACING", 0))) Source('debug/flags.cc') -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39077 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: If40f2f708be1495fa2b2380266164d5d44d7cffa Gerrit-Change-Number: 39077 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: cpu-o3: Add missing tid in Rename's debug message
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/39075 ) Change subject: cpu-o3: Add missing tid in Rename's debug message .. cpu-o3: Add missing tid in Rename's debug message These arguments were missing. Change-Id: I8a76e46b2bcfc57f299145954fe72196f5969f29 Signed-off-by: Daniel R. Carvalho --- M src/cpu/o3/rename_impl.hh 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cpu/o3/rename_impl.hh b/src/cpu/o3/rename_impl.hh index 007ec87..68150f9 100644 --- a/src/cpu/o3/rename_impl.hh +++ b/src/cpu/o3/rename_impl.hh @@ -612,7 +612,8 @@ if (inst->isLoad()) { if (calcFreeLQEntries(tid) <= 0) { -DPRINTF(Rename, "[tid:%i] Cannot rename due to no free LQ\n"); +DPRINTF(Rename, "[tid:%i] Cannot rename due to no free LQ\n", +tid); source = LQ; incrFullStat(source); break; @@ -621,7 +622,8 @@ if (inst->isStore() || inst->isAtomic()) { if (calcFreeSQEntries(tid) <= 0) { -DPRINTF(Rename, "[tid:%i] Cannot rename due to no free SQ\n"); +DPRINTF(Rename, "[tid:%i] Cannot rename due to no free SQ\n", +tid); source = SQ; incrFullStat(source); break; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39075 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: I8a76e46b2bcfc57f299145954fe72196f5969f29 Gerrit-Change-Number: 39075 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: scons: Separate debug flags from debug-format flags
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/39076 ) Change subject: scons: Separate debug flags from debug-format flags .. scons: Separate debug flags from debug-format flags Debug flags are flags that aid with debugging by printing relevant information when enabled. Debug-formatting flags define how the debug flags will print the information. Although a viability, this patch does not support declaring compound format flags. Finally, as of this patch, the C++ debug flag code is still unaware of this difference. Change-Id: Ieae68745276218cf4e9c1d37d7bf3bd1f19709ae Signed-off-by: Daniel R. Carvalho --- M src/SConscript M src/base/SConscript 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/SConscript b/src/SConscript index b55f485..2533810 100644 --- a/src/SConscript +++ b/src/SConscript @@ -623,20 +623,24 @@ # Debug Flags # debug_flags = {} -def DebugFlag(name, desc=None): +def DebugFlag(name, desc=None, fmt=False): if name in debug_flags: raise AttributeError("Flag {} already specified".format(name)) -debug_flags[name] = (name, (), desc) +debug_flags[name] = (name, (), desc, fmt) def CompoundFlag(name, flags, desc=None): if name in debug_flags: raise AttributeError("Flag {} already specified".format(name)) compound = tuple(flags) -debug_flags[name] = (name, compound, desc) +debug_flags[name] = (name, compound, desc, False) + +def DebugFormatFlag(name, desc=None): +DebugFlag(name, desc, True) Export('DebugFlag') Export('CompoundFlag') +Export('DebugFormatFlag') # @@ -1114,7 +1118,7 @@ ''') for name, flag in sorted(source[0].read().items()): -n, compound, desc = flag +n, compound, desc, fmt = flag assert n == name if not compound: @@ -1137,7 +1141,7 @@ assert(len(target) == 1 and len(source) == 1) val = eval(source[0].get_contents()) -name, compound, desc = val +name, compound, desc, fmt = val code = code_formatter() @@ -1173,7 +1177,7 @@ code.write(str(target[0])) for name,flag in sorted(debug_flags.items()): -n, compound, desc = flag +n, compound, desc, fmt = flag assert n == name hh_file = 'debug/%s.hh' % name diff --git a/src/base/SConscript b/src/base/SConscript index 3ac9838..5b5e578 100644 --- a/src/base/SConscript +++ b/src/base/SConscript @@ -99,10 +99,6 @@ 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('FmtStackTrace', -"Print a stack trace after every 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.") @@ -121,3 +117,8 @@ CompoundFlag('AnnotateAll', ['Annotate', 'AnnotateQ', 'AnnotateVerbose'], desc="All Annotation flags") +DebugFormatFlag('FmtFlag', +"Show the --debug-flag that enabled each debug message") +DebugFormatFlag('FmtStackTrace', +"Print a stack trace after every debug message") +DebugFormatFlag('FmtTicksOff', "Don't show tick count on debug messages") -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39076 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: Ieae68745276218cf4e9c1d37d7bf3bd1f19709ae Gerrit-Change-Number: 39076 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Add documentation to flags.hh
+ * Replace the contents of the bits matching the mask with the + * corresponding bits in the provided flags. + * + * This is equivalent to: + * flags.clear(mask); flags.set(flags & mask); + * + * @param flags Flags to extract new bits from. + * @param mask Mask used to determine which bits are replaced. + */ void update(Type flags, Type mask) { -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38735 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: I924b1d5c20a3e2066be64ab124ae1a5d96d4b3bf Gerrit-Change-Number: 38735 Gerrit-PatchSet: 4 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Remove Flags assignment
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/38713 ) Change subject: base: Remove Flags assignment .. base: Remove Flags assignment Currently unused and broken. Since these are templated classes, and _flags is private, the assignment is a compilation error. Furthermore, assignment of flags of different types is likely undefined behavior. Change-Id: I8430045c42c003efc74e343cc5b4a4350bc2ad92 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38713 Reviewed-by: Jason Lowe-Power Reviewed-by: Andreas Sandberg Reviewed-by: Bobby R. Bruce Maintainer: Jason Lowe-Power Tested-by: kokoro --- M src/base/flags.hh 1 file changed, 0 insertions(+), 11 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved Andreas Sandberg: Looks good to me, approved Bobby R. Bruce: Looks good to me, but someone else must approve kokoro: Regressions pass diff --git a/src/base/flags.hh b/src/base/flags.hh index 505a1e5..8cefd2d 100644 --- a/src/base/flags.hh +++ b/src/base/flags.hh @@ -58,17 +58,6 @@ /** * @ingroup api_flags */ -template -const Flags & -operator=(const Flags ) -{ -_flags = flags._flags; -return *this; -} - -/** - * @ingroup api_flags - */ const Flags & operator=(T flags) { -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38713 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: I8430045c42c003efc74e343cc5b4a4350bc2ad92 Gerrit-Change-Number: 38713 Gerrit-PatchSet: 4 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Andreas Sandberg Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Hoa Nguyen Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Fix uninitialized variable in Flag
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/38707 ) Change subject: base: Fix uninitialized variable in Flag .. base: Fix uninitialized variable in Flag This was uninitialized, and was breaking expected values under certain situations. Change-Id: If51ab6ae038c7c397bc83de1c73af348c1db4ef8 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38707 Reviewed-by: Bobby R. Bruce Reviewed-by: Andreas Sandberg Maintainer: Bobby R. Bruce Tested-by: kokoro --- M src/base/debug.cc M src/base/debug.hh 2 files changed, 5 insertions(+), 5 deletions(-) Approvals: Andreas Sandberg: Looks good to me, approved Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/base/debug.cc b/src/base/debug.cc index 45d9f9d..9cfd45e 100644 --- a/src/base/debug.cc +++ b/src/base/debug.cc @@ -100,6 +100,8 @@ panic("Flag %s already defined!", name); ++allFlagsVersion; + +sync(); } Flag::~Flag() diff --git a/src/base/debug.hh b/src/base/debug.hh index 7cc7137..6006b14 100644 --- a/src/base/debug.hh +++ b/src/base/debug.hh @@ -82,15 +82,13 @@ class SimpleFlag : public Flag { protected: -bool _tracing; // tracing is enabled and flag is on -bool _status; // flag status +bool _tracing = false; // tracing is enabled and flag is on +bool _status = false; // flag status void sync() override { _tracing = _globalEnable && _status; } public: -SimpleFlag(const char *name, const char *desc) -: Flag(name, desc), _status(false) -{ } +SimpleFlag(const char *name, const char *desc) : Flag(name, desc) {} bool status() const override { return _tracing; } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38707 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: If51ab6ae038c7c397bc83de1c73af348c1db4ef8 Gerrit-Change-Number: 38707 Gerrit-PatchSet: 4 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Andreas Sandberg Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Remove flag from allFlags on destruction
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/38709 ) Change subject: base: Remove flag from allFlags on destruction .. base: Remove flag from allFlags on destruction When a flag is destroyed it must be removed from the list containing all flags. Use this opportunity to remove "using namespace std" since it is barely used. Change-Id: I201371a770c56e11b92532e146d577c6ecb29d34 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38709 Reviewed-by: Andreas Sandberg Reviewed-by: Gabe Black Maintainer: Bobby R. Bruce Tested-by: kokoro --- M src/base/debug.cc 1 file changed, 3 insertions(+), 5 deletions(-) Approvals: Andreas Sandberg: Looks good to me, approved Gabe Black: Looks good to me, approved Bobby R. Bruce: Looks good to me, approved kokoro: Regressions pass diff --git a/src/base/debug.cc b/src/base/debug.cc index 9cfd45e..8eaf2c6 100644 --- a/src/base/debug.cc +++ b/src/base/debug.cc @@ -49,8 +49,6 @@ #include "base/cprintf.hh" #include "base/logging.hh" -using namespace std; - namespace Debug { // @@ -93,8 +91,8 @@ Flag::Flag(const char *name, const char *desc) : _name(name), _desc(desc) { -pair result = -allFlags().insert(make_pair(name, this)); +std::pair result = +allFlags().insert(std::make_pair(name, this)); if (!result.second) panic("Flag %s already defined!", name); @@ -106,7 +104,7 @@ Flag::~Flag() { -// should find and remove flag. +allFlags().erase(name()); } void -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38709 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: I201371a770c56e11b92532e146d577c6ecb29d34 Gerrit-Change-Number: 38709 Gerrit-PatchSet: 4 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Andreas Sandberg Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Assert Flags' type is unsigned
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/38712 ) Change subject: base: Assert Flags' type is unsigned .. base: Assert Flags' type is unsigned Operations rely on the use of unsigned integers. Change-Id: I825a88f81b54577585976d6558b1409870897721 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38712 Reviewed-by: Jason Lowe-Power Maintainer: Bobby R. Bruce Tested-by: kokoro --- M src/base/flags.hh 1 file changed, 4 insertions(+), 0 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved Bobby R. Bruce: Looks good to me, approved kokoro: Regressions pass diff --git a/src/base/flags.hh b/src/base/flags.hh index c9525fa..505a1e5 100644 --- a/src/base/flags.hh +++ b/src/base/flags.hh @@ -29,10 +29,14 @@ #ifndef __BASE_FLAGS_HH__ #define __BASE_FLAGS_HH__ +#include + template class Flags { private: +static_assert(std::is_unsigned::value, "Flag type must be unsigned"); + T _flags; public: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38712 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: I825a88f81b54577585976d6558b1409870897721 Gerrit-Change-Number: 38712 Gerrit-PatchSet: 4 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Fix update of useful prefetches
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/38177 ) Change subject: mem-cache: Fix update of useful prefetches .. mem-cache: Fix update of useful prefetches The probe notification must be parsed on every hit, even if the prefetcher is set not to generate prefetches on accesses. This fixes the calculation of useful prefetches. Change-Id: Iff298f7bea11013f411f4ba39dba705fd81a0cd4 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38177 Reviewed-by: Bobby R. Bruce Maintainer: Bobby R. Bruce Tested-by: kokoro --- M src/mem/cache/prefetch/base.cc 1 file changed, 3 insertions(+), 4 deletions(-) Approvals: Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/mem/cache/prefetch/base.cc b/src/mem/cache/prefetch/base.cc index 28aaa62..e347992 100644 --- a/src/mem/cache/prefetch/base.cc +++ b/src/mem/cache/prefetch/base.cc @@ -125,6 +125,7 @@ bool read = pkt->isRead(); bool inv = pkt->isInvalidate(); +if (!miss && !prefetchOnAccess) return false; if (pkt->req->isUncacheable()) return false; if (fetch && !onInst) return false; if (!fetch && !onData) return false; @@ -236,10 +237,8 @@ true)); listeners.push_back(new PrefetchListener(*this, pm, "Fill", true, false)); -if (prefetchOnAccess) { -listeners.push_back(new PrefetchListener(*this, pm, "Hit", false, - false)); -} +listeners.push_back(new PrefetchListener(*this, pm, "Hit", false, + false)); } } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38177 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: Iff298f7bea11013f411f4ba39dba705fd81a0cd4 Gerrit-Change-Number: 38177 Gerrit-PatchSet: 3 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Nikos Nikoleris Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: misc: Fix coding style for class-opening braces
me when request is ready to be serviced diff --git a/src/mem/cache/write_queue_entry.hh b/src/mem/cache/write_queue_entry.hh index 2aebacf..d50de35 100644 --- a/src/mem/cache/write_queue_entry.hh +++ b/src/mem/cache/write_queue_entry.hh @@ -73,7 +73,8 @@ friend class WriteQueue; public: -class TargetList : public std::list { +class TargetList : public std::list +{ public: diff --git a/src/mem/packet_queue.hh b/src/mem/packet_queue.hh index baf6152..1509862 100644 --- a/src/mem/packet_queue.hh +++ b/src/mem/packet_queue.hh @@ -63,7 +63,8 @@ { private: /** A deferred packet, buffered to transmit later. */ -class DeferredPacket { +class DeferredPacket +{ public: Tick tick; ///< The tick when the packet is ready to transmit PacketPtr pkt; ///< Pointer to the packet to transmit diff --git a/src/mem/ruby/system/CacheRecorder.hh b/src/mem/ruby/system/CacheRecorder.hh index 53ab8e5..b295be6 100644 --- a/src/mem/ruby/system/CacheRecorder.hh +++ b/src/mem/ruby/system/CacheRecorder.hh @@ -51,7 +51,8 @@ * length object, so that while writing the data to a file one does not * need to copy the meta data and the actual data separately. */ -class TraceRecord { +class TraceRecord +{ public: int m_cntrl_id; Tick m_time; diff --git a/src/mem/snoop_filter.hh b/src/mem/snoop_filter.hh index abd66a8..42f95ca 100644 --- a/src/mem/snoop_filter.hh +++ b/src/mem/snoop_filter.hh @@ -83,7 +83,8 @@ * (4) ordering: there is no single point of order in the system. Instead, * requesting MSHRs track order between local requests and remote snoops */ -class SnoopFilter : public SimObject { +class SnoopFilter : public SimObject +{ public: // Change for systems with more than 256 ports tracked by this object diff --git a/src/sim/futex_map.hh b/src/sim/futex_map.hh index 081b850..a8a8141 100644 --- a/src/sim/futex_map.hh +++ b/src/sim/futex_map.hh @@ -38,7 +38,8 @@ * FutexKey class defines an unique identifier for a particular futex in the * system. The tgid and an address are the unique values needed as the key. */ -class FutexKey { +class FutexKey +{ public: uint64_t addr; uint64_t tgid; @@ -65,7 +66,8 @@ * WaiterState defines internal state of a waiter thread. The state * includes a pointer to the thread's context and its associated bitmask. */ -class WaiterState { +class WaiterState +{ public: ThreadContext* tc; int bitmask; diff --git a/src/sim/linear_solver.hh b/src/sim/linear_solver.hh index ca59a81..0ecf7f7 100644 --- a/src/sim/linear_solver.hh +++ b/src/sim/linear_solver.hh @@ -49,7 +49,8 @@ * N+1 coefficients. */ -class LinearEquation { +class LinearEquation +{ public: LinearEquation(unsigned unknowns) { eq = std::vector (unknowns + 1, 0); @@ -104,7 +105,8 @@ std::vector eq; }; -class LinearSystem { +class LinearSystem +{ public: LinearSystem(unsigned unknowns) { for (unsigned i = 0; i < unknowns; i++) diff --git a/src/sim/mathexpr.hh b/src/sim/mathexpr.hh index 3dfe2b8..73247c2 100644 --- a/src/sim/mathexpr.hh +++ b/src/sim/mathexpr.hh @@ -44,7 +44,8 @@ #include #include -class MathExpr { +class MathExpr +{ public: MathExpr(std::string expr); @@ -102,7 +103,8 @@ /** Operator list */ std::array ops; -class Node { +class Node +{ public: Node() : op(nInvalid), l(0), r(0), value(0) {} std::string toStr() const { diff --git a/src/sim/se_signal.hh b/src/sim/se_signal.hh index e3241f5..f5f1675 100644 --- a/src/sim/se_signal.hh +++ b/src/sim/se_signal.hh @@ -33,7 +33,8 @@ class Process; -class BasicSignal { +class BasicSignal +{ public: Process *sender; Process *receiver; diff --git a/src/sim/serialize.hh b/src/sim/serialize.hh index 3acefa4..7525c1f 100644 --- a/src/sim/serialize.hh +++ b/src/sim/serialize.hh @@ -164,7 +164,8 @@ class Serializable { public: -class ScopedCheckpointSection { +class ScopedCheckpointSection +{ public: /** * This is the constructor for Scoped checkpoint section helper diff --git a/src/sim/syscall_emul_buf.hh b/src/sim/syscall_emul_buf.hh index dbe9f96..2a79ccd 100644 --- a/src/sim/syscall_emul_buf.hh +++ b/src/sim/syscall_emul_buf.hh @@ -51,7 +51,8 @@ * and copyOut() methods copy the user-space buffer to and from the * simulator-space buffer, respectively. */ -class BaseBufferArg { +class BaseBufferArg +{ public: diff --git a/src/unittest/stattest.cc b/src/unittest/stattest.cc index 4030735..301fea2 100644 --- a/src/unittest/stattest.cc +++ b/src/unittest/stattest.cc @@ -63,7 +63,8 @@ return 9.8; } -class TestClass { +class TestClass +{ public: double operator()() { return 9.7; } }; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39015 To unsubscribe, or for help writing mail filters, visit https://gem5-review.google
[gem5-dev] Change in gem5/gem5[develop]: util: Add verifier for opening braces of classes
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/39016 ) Change subject: util: Add verifier for opening braces of classes .. util: Add verifier for opening braces of classes Make sure that opening braces of classes are not declared in the same line of the class name. This does not work for multi-line classes. Change-Id: I232df1a9ebd974b9f4f66e1d96d03b12513bd49f Signed-off-by: Daniel R. Carvalho --- M util/style/verifiers.py 1 file changed, 27 insertions(+), 0 deletions(-) diff --git a/util/style/verifiers.py b/util/style/verifiers.py index 7d27fda..ddfc0fb 100644 --- a/util/style/verifiers.py +++ b/util/style/verifiers.py @@ -460,6 +460,33 @@ "comparisons with false/False.\n") return line +class ClassBraces(LineVerifier): +""" Check if the opening braces of classes are not on the same line of +the class name. + +@todo Make this work for multi-line class declarations. e.g., + +class MultiLineClass + : public BaseClass { +""" + +languages = set(('C', 'C++')) +test_name = 'class opening brace position' +opt_name = 'classbrace' + +regex = re.compile(r'\A(\s*)(class\s+[A-Z].*\S)\s*\{') + +def check_line(self, line, **kwargs): +return self.regex.search(line) == None + +def fix_line(self, line, **kwargs): +match = self.regex.search(line) +if match: +# Group 1 is indentation, group 2 is class declaration +line = match.group(1) + match.group(2) + "\n" + \ +match.group(1) + "{" +return line + def is_verifier(cls): """Determine if a class is a Verifier that can be instantiated""" -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39016 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: I232df1a9ebd974b9f4f66e1d96d03b12513bd49f Gerrit-Change-Number: 39016 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Move Named class to its own file
Tick complete) +MemChecker::ByteTracker::completeWrite(MemChecker::Serial serial, +Tick complete) { getIncompleteWriteCluster()->completeWrite(serial, complete); pruneTransactions(); @@ -282,7 +285,7 @@ // Pruning of readObservations readObservations.erase(readObservations.begin(), - lastCompletedTransaction(, before)); +lastCompletedTransaction(, before)); // Pruning of writeClusters if (!writeClusters.empty()) { diff --git a/src/mem/mem_checker.hh b/src/mem/mem_checker.hh index 41aa691..7060f88 100644 --- a/src/mem/mem_checker.hh +++ b/src/mem/mem_checker.hh @@ -38,13 +38,15 @@ #ifndef __MEM_MEM_CHECKER_HH__ #define __MEM_MEM_CHECKER_HH__ +#include +#include #include #include #include #include #include -#include "base/logging.hh" +#include "base/named.hh" #include "base/trace.hh" #include "base/types.hh" #include "debug/MemChecker.hh" -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38743 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: I314e850b4fafd7804d919fd3fe6dec44822e1f48 Gerrit-Change-Number: 38743 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Add M5_VAR_USED in Debug::Flag
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38742 ) Change subject: base: Add M5_VAR_USED in Debug::Flag .. base: Add M5_VAR_USED in Debug::Flag Add M5_VAR_USED to a variable that is not used in .fast builds. Change-Id: Ib50043dfd9e9734c0d6435c37ba8d6d65f5723a7 Signed-off-by: Daniel R. Carvalho --- M src/base/debug.cc 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/base/debug.cc b/src/base/debug.cc index dbf92cf..06597f6 100644 --- a/src/base/debug.cc +++ b/src/base/debug.cc @@ -45,7 +45,9 @@ #include #include +#include +#include "base/compiler.hh" #include "base/cprintf.hh" #include "base/logging.hh" @@ -91,11 +93,10 @@ Flag::Flag(const char *name, const char *desc) : _name(name), _desc(desc) { -std::pair result = +M5_VAR_USED std::pair result = allFlags().insert(std::make_pair(name, this)); -if (!result.second) -panic("Flag %s already defined!", name); +panic_if(!result.second, "Flag %s already defined!", name); ++allFlagsVersion; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38742 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: Ib50043dfd9e9734c0d6435c37ba8d6d65f5723a7 Gerrit-Change-Number: 38742 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sim: Fix ParseParam and add Parse/ShowParam tests
e)); +EXPECT_FALSE(parser.parse("-1000", value)); + +// 32-bit values +EXPECT_FALSE(parser.parse("2147483648", value)); +EXPECT_FALSE(parser.parse("-1073741824", value)); + +// Doubles +EXPECT_FALSE(parser.parse("123456.789", value)); +EXPECT_FALSE(parser.parse("-123456.789", value)); +EXPECT_TRUE(parser.parse("9.87654e+06", value)); +EXPECT_EQ(char(9), value); + +// Characters +EXPECT_TRUE(parser.parse("69", value)); +EXPECT_EQ('E', value); +EXPECT_TRUE(parser.parse("97", value)); +EXPECT_EQ('a', value); + +// Strings +EXPECT_FALSE(parser.parse("Test", value)); +} + +TEST(SerializeTest, ParseParamString) +{ +ParseParam parser; +std::string value(""); + +// Zero +EXPECT_TRUE(parser.parse("0", value)); +EXPECT_EQ("0", value); + +// Booleans +EXPECT_TRUE(parser.parse("true", value)); +EXPECT_EQ("true", value); +EXPECT_TRUE(parser.parse("false", value)); +EXPECT_EQ("false", value); + +// 8-bit values +EXPECT_TRUE(parser.parse("255", value)); +EXPECT_EQ("255", value); +EXPECT_TRUE(parser.parse("-128", value)); +EXPECT_EQ("-128", value); + +// 16-bit values +EXPECT_TRUE(parser.parse("1000", value)); +EXPECT_EQ("1000", value); +EXPECT_TRUE(parser.parse("-1000", value)); +EXPECT_EQ("-1000", value); + +// 32-bit values +EXPECT_TRUE(parser.parse("2147483648", value)); +EXPECT_EQ("2147483648", value); +EXPECT_TRUE(parser.parse("-1073741824", value)); +EXPECT_EQ("-1073741824", value); + +// Doubles +EXPECT_TRUE(parser.parse("123456.789", value)); +EXPECT_EQ("123456.789", value); +EXPECT_TRUE(parser.parse("-123456.789", value)); +EXPECT_EQ("-123456.789", value); +EXPECT_TRUE(parser.parse("9.87654e+06", value)); +EXPECT_EQ("9.87654e+06", value); + +// Characters +EXPECT_TRUE(parser.parse("E", value)); +EXPECT_EQ("E", value); +EXPECT_TRUE(parser.parse("a", value)); +EXPECT_EQ("a", value); + +// Strings +EXPECT_TRUE(parser.parse("Test", value)); +EXPECT_EQ("Test", value); +} + +TEST(SerializeTest, ShowParamInt8) +{ +ShowParam parser; +std::stringstream ss; + +parser.show(ss, 0); +EXPECT_EQ("0", ss.str()); +ss.str(""); +parser.show(ss, 127); +EXPECT_EQ("127", ss.str()); +ss.str(""); +parser.show(ss, -128); +EXPECT_EQ("-128", ss.str()); +ss.str(""); +} + +TEST(SerializeTest, ShowParamUint32) +{ +ShowParam parser; +std::stringstream ss; + +parser.show(ss, 0); +EXPECT_EQ("0", ss.str()); +ss.str(""); +parser.show(ss, 255); +EXPECT_EQ("255", ss.str()); +ss.str(""); +parser.show(ss, 1000); +EXPECT_EQ("1000", ss.str()); +ss.str(""); +parser.show(ss, 2147483648); +EXPECT_EQ("2147483648", ss.str()); +ss.str(""); +parser.show(ss, 123456.789); +EXPECT_EQ("123456", ss.str()); +ss.str(""); +parser.show(ss, 9.87654e+06); +EXPECT_EQ("9876540", ss.str()); +ss.str(""); +} + +/** + * Test converting doubles to strings. Floating numbers are expected to + * have 6-digit precision. + */ +TEST(SerializeTest, ShowParamDouble) +{ +ShowParam parser; +std::stringstream ss; + +parser.show(ss, 0); +EXPECT_EQ("0", ss.str()); +ss.str(""); +parser.show(ss, 255); +EXPECT_EQ("255", ss.str()); +ss.str(""); +parser.show(ss, -1000); +EXPECT_EQ("-1000", ss.str()); +ss.str(""); +parser.show(ss, 123456.789); +EXPECT_EQ("123457", ss.str()); +ss.str(""); +parser.show(ss, -123456.789); +EXPECT_EQ("-123457", ss.str()); +ss.str(""); +parser.show(ss, 1234567.89); +EXPECT_EQ("1.23457e+06", ss.str()); +ss.str(""); +parser.show(ss, -1234567.89); +EXPECT_EQ("-1.23457e+06", ss.str()); +ss.str(""); +parser.show(ss, 9.87654e+06); +EXPECT_EQ("9.87654e+06", ss.str()); +ss.str(""); +} + +TEST(SerializeTest, ShowParamBool) +{ +ShowParam parser; +std::stringstream ss; + +parser.show(ss, true); +EXPECT_EQ("true", ss.str()); +ss.str(""); +parser.show(ss, false); +EXPECT_EQ("false", ss.str()); +ss.str(""); +} + +TEST(SerializeTest, ShowParamChar) +{ +ShowParam parser; +std::stringstream ss; + +parser.show(ss, 'E'); +EXPECT_EQ("69", ss.str()); // int('E')=69 +ss.str(""); +parser.show(ss, 'a'); +EXPECT_EQ("97", ss.str()); // int('a')=97 +ss.str(""); +} + +TEST(SerializeTest, ShowParamString) +{ +ShowParam parser; +std::stringstream ss; + +parser.show(ss, "test"); +EXPECT_EQ("test", ss.str()); +ss.str(""); +parser.show(ss, "tEsT"); +EXPECT_EQ("tEsT", ss.str()); +ss.str(""); +} -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38776 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: I1128c7adb12a3c7d091e26db13733ba45e1e61fe Gerrit-Change-Number: 38776 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Add double tests to base/str
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38775 ) Change subject: base: Add double tests to base/str .. base: Add double tests to base/str Add a few extra tests for conversions from double string. One verifies that strings containing a double are always rounded down when converted to integer types; the second verifies that converting numbers in scientific notation to integers will yield incorrect results; and the third converts a string containing a number in scientific notation to double. Change-Id: I6a9599d8473909d274326b6f8c268e3603044ab4 Signed-off-by: Daniel R. Carvalho --- M src/base/str.test.cc 1 file changed, 27 insertions(+), 0 deletions(-) diff --git a/src/base/str.test.cc b/src/base/str.test.cc index a064a87..9d8aa60 100644 --- a/src/base/str.test.cc +++ b/src/base/str.test.cc @@ -285,6 +285,24 @@ EXPECT_FALSE(to_number(input, output)); } +TEST(StrTest, ToNumberIntRoundDown) +{ +uint32_t output; +std::string input = "2.99"; +EXPECT_TRUE(to_number(input, output)); +EXPECT_EQ(2, output); +} + +TEST(StrTest, ToNumberIntScientific) +{ +// Scientific number conversion should be done with floating numbers. +// If converting to ints, conversion will be done incorrectly, as expected +uint32_t output; +std::string input = "8.234e+08"; +EXPECT_TRUE(to_number(input, output)); +EXPECT_EQ(8, output); +} + TEST(StrTest, ToNumber64BitInt) { int64_t output; @@ -355,6 +373,15 @@ EXPECT_EQ(expected_output, output); } +TEST(StrTest, ToNumberScientific) +{ +double output; +std::string input = "8.234e+08"; +double expected_output = 82340; +EXPECT_TRUE(to_number(input, output)); +EXPECT_EQ(expected_output, output); +} + /* * The "to_bool" function takes a string, "true" or "false" * (case-insenstive), and sets the second argument to the bool equivilent. -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38775 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: I6a9599d8473909d274326b6f8c268e3603044ab4 Gerrit-Change-Number: 38775 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sim: Remove SimObject and Event dependency from serialize.hh
9b0715..99e27cb 100644 --- a/src/sim/sim_object.cc +++ b/src/sim/sim_object.cc @@ -51,6 +51,7 @@ // SimObject::SimObjectList SimObject::simObjectList; SimObjectResolver *SimObject::_objNameResolver = NULL; +Globals SimObject::globals; // // SimObject constructor: used to maintain static simObjectList @@ -132,8 +133,13 @@ // static function: serialize all SimObjects. // void -SimObject::serializeAll(CheckpointOut ) +SimObject::serializeAll(const std::string _dir) { +std::ofstream cp; +Serializable::generateCheckpointOut(cpt_dir, cp); + +globals.serializeSection(cp, "Globals"); + SimObjectList::reverse_iterator ri = simObjectList.rbegin(); SimObjectList::reverse_iterator rend = simObjectList.rend(); @@ -145,6 +151,14 @@ } } +void +SimObject::unserializeGlobals(CheckpointIn ) +{ +globals.unserializeSection(cp, "Globals"); + +for (uint32_t i = 0; i < numMainEventQueues; ++i) +mainEventQueue[i]->setCurTick(globals.unserializedCurTick); +} #ifdef DEBUG // @@ -198,3 +212,20 @@ assert(_objNameResolver); return _objNameResolver; } + +void +objParamIn(CheckpointIn , const std::string , SimObject * ) +{ +const std::string (Serializable::currentSection()); +std::string path; +if (!cp.find(section, name, path)) { +fatal("Can't unserialize '%s:%s'\n", section, name); +} +param = SimObject::getSimObjectResolver()->resolveSimObject(path); +} + +void +debug_serialize(const std::string _dir) +{ +SimObject::serializeAll(cpt_dir); +} diff --git a/src/sim/sim_object.hh b/src/sim/sim_object.hh index 719f5a5..64b6207 100644 --- a/src/sim/sim_object.hh +++ b/src/sim/sim_object.hh @@ -53,6 +53,7 @@ #include "params/SimObject.hh" #include "sim/drain.hh" #include "sim/eventq.hh" +#include "sim/globals.hh" #include "sim/port.hh" #include "sim/serialize.hh" @@ -131,6 +132,9 @@ /** Helper to resolve an object given its name. */ static SimObjectResolver *_objNameResolver; +/** The one and only instance of the Globals class. */ +static Globals globals; + /** Manager coordinates hooking up probe points with listeners. */ ProbeManager *probeManager; @@ -300,13 +304,14 @@ /** * Serialize all SimObjects in the system. */ -static void serializeAll(CheckpointOut ); +static void serializeAll(const std::string _dir); -#ifdef DEBUG - public: -bool doDebugBreak; -static void debugObjectBreak(const std::string ); -#endif +/** + * Unserialize globals. + * + * @ingroup api_serialize + */ +void unserializeGlobals(CheckpointIn ); /** * Find the SimObject with the given name and return a pointer to @@ -332,6 +337,12 @@ * @return Pointer to the single sim object name resolver. */ static SimObjectResolver *getSimObjectResolver(); + +#ifdef DEBUG + public: +bool doDebugBreak; +static void debugObjectBreak(const std::string ); +#endif }; /** @@ -357,4 +368,47 @@ void debugObjectBreak(const char *objs); #endif +/** + * To avoid circular dependencies the unserialization of SimObjects must be + * implemented here. + * + * @ingroup api_serialize + */ +void objParamIn(CheckpointIn , const std::string , SimObject * ); + +void debug_serialize(const std::string _dir); + +/** + * \def SERIALIZE_OBJ(obj) + * + * @ingroup api_serialize + */ +#define SERIALIZE_OBJ(obj) obj.serializeSection(cp, #obj) + +/** + * \def UNSERIALIZE_OBJ(obj) + * + * @ingroup api_serialize + */ +#define UNSERIALIZE_OBJ(obj) obj.unserializeSection(cp, #obj) + +/** + * \def SERIALIZE_OBJPTR(objptr) + * + * @ingroup api_serialize + */ +#define SERIALIZE_OBJPTR(objptr)paramOut(cp, #objptr, (objptr)->name()) + +/** + * \def UNSERIALIZE_OBJPTR(objptr) + * + * @ingroup api_serialize + */ +#define UNSERIALIZE_OBJPTR(objptr) \ +do {\ +SimObject *sptr;\ +objParamIn(cp, #objptr, sptr); \ +objptr = dynamic_cast(sptr); \ +} while (0) + #endif // __SIM_OBJECT_HH__ -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38740 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: I9438b799d7e9d4c992a62c7f9d1f15f3f3250a5a Gerrit-Change-Number: 38740 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sim: Make IniFile non-pointer in CheckpointIn
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38741 ) Change subject: sim: Make IniFile non-pointer in CheckpointIn .. sim: Make IniFile non-pointer in CheckpointIn There is no need to use a pointer for this variable. Change-Id: I784c94c8b775880def8339df63540357c2078c7b Signed-off-by: Daniel R. Carvalho --- M src/sim/serialize.cc M src/sim/serialize.hh 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/sim/serialize.cc b/src/sim/serialize.cc index 177aee6..94d0e0f 100644 --- a/src/sim/serialize.cc +++ b/src/sim/serialize.cc @@ -49,7 +49,6 @@ #include #include -#include "base/inifile.hh" #include "base/trace.hh" #include "debug/Checkpoint.hh" @@ -156,18 +155,14 @@ } CheckpointIn::CheckpointIn(const string _dir) -: db(new IniFile), _cptDir(setDir(cpt_dir)) +: db(), _cptDir(setDir(cpt_dir)) { string filename = getCptDir() + "/" + CheckpointIn::baseFilename; -if (!db->load(filename)) { +if (!db.load(filename)) { fatal("Can't load checkpoint file '%s'\n", filename); } } -CheckpointIn::~CheckpointIn() -{ -delete db; -} /** * @param section Here we mention the section we are looking for * (example: currentsection). @@ -180,7 +175,7 @@ bool CheckpointIn::entryExists(const string , const string ) { -return db->entryExists(section, entry); +return db.entryExists(section, entry); } /** * @param section Here we mention the section we are looking for @@ -195,11 +190,11 @@ bool CheckpointIn::find(const string , const string , string ) { -return db->find(section, entry, value); +return db.find(section, entry, value); } bool CheckpointIn::sectionExists(const string ) { -return db->sectionExists(section); +return db.sectionExists(section); } diff --git a/src/sim/serialize.hh b/src/sim/serialize.hh index d4a94f2..3acefa4 100644 --- a/src/sim/serialize.hh +++ b/src/sim/serialize.hh @@ -56,24 +56,22 @@ #include #include +#include "base/inifile.hh" #include "base/logging.hh" #include "sim/serialize_handlers.hh" -class IniFile; - typedef std::ostream CheckpointOut; class CheckpointIn { private: - -IniFile *db; +IniFile db; const std::string _cptDir; public: CheckpointIn(const std::string _dir); -~CheckpointIn(); +~CheckpointIn() = default; /** * @return Returns the current directory being used for creating -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38741 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: I784c94c8b775880def8339df63540357c2078c7b Gerrit-Change-Number: 38741 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sim: Move SimObjectResolver dependency to SimObject
s things that @@ -127,6 +128,9 @@ /** List of all instantiated simulation objects. */ static SimObjectList simObjectList; +/** Helper to resolve an object given its name. */ +static SimObjectResolver *_objNameResolver; + /** Manager coordinates hooking up probe points with listeners. */ ProbeManager *probeManager; @@ -312,6 +316,22 @@ * @ingroup api_simobject */ static SimObject *find(const char *name); + +/** + * There is a single object name resolver, and it is only set when + * simulation is restoring from checkpoints. + * + * @param Pointer to the single sim object name resolver. + */ +static void setSimObjectResolver(SimObjectResolver *resolver); + +/** + * There is a single object name resolver, and it is only set when + * simulation is restoring from checkpoints. + * + * @return Pointer to the single sim object name resolver. + */ +static SimObjectResolver *getSimObjectResolver(); }; /** -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38739 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: I9973bea0e3c6cabb0051a55dbf9aebef8a50fba8 Gerrit-Change-Number: 38739 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: misc: Fix some includes
quot;base/str.hh" + static std::string normalizePath(std::string path) { diff --git a/src/sim/root.hh b/src/sim/root.hh index fa152ff..a8337ed 100644 --- a/src/sim/root.hh +++ b/src/sim/root.hh @@ -53,6 +53,7 @@ #include "base/statistics.hh" #include "base/time.hh" +#include "base/types.hh" #include "params/Root.hh" #include "sim/eventq.hh" #include "sim/sim_object.hh" diff --git a/src/sim/serialize_handlers.hh b/src/sim/serialize_handlers.hh index 8efd895..5e5c3ff 100644 --- a/src/sim/serialize_handlers.hh +++ b/src/sim/serialize_handlers.hh @@ -47,8 +47,8 @@ #include -#include #include +#include #include "base/str.hh" diff --git a/src/sim/sim_exit.hh b/src/sim/sim_exit.hh index a79d3e2..d1791f5 100644 --- a/src/sim/sim_exit.hh +++ b/src/sim/sim_exit.hh @@ -29,6 +29,7 @@ #ifndef __SIM_EXIT_HH__ #define __SIM_EXIT_HH__ +#include #include #include "base/types.hh" diff --git a/src/sim/ticked_object.cc b/src/sim/ticked_object.cc index 3564b4d..79cbd41 100644 --- a/src/sim/ticked_object.cc +++ b/src/sim/ticked_object.cc @@ -39,6 +39,7 @@ #include "params/TickedObject.hh" #include "sim/clocked_object.hh" +#include "sim/serialize.hh" Ticked::Ticked(ClockedObject _, Stats::Scalar *imported_num_cycles, diff --git a/src/sim/voltage_domain.cc b/src/sim/voltage_domain.cc index f6f8396..d770af8 100644 --- a/src/sim/voltage_domain.cc +++ b/src/sim/voltage_domain.cc @@ -39,11 +39,11 @@ #include -#include "base/statistics.hh" +#include "base/logging.hh" #include "base/trace.hh" #include "debug/VoltageDomain.hh" #include "params/VoltageDomain.hh" -#include "sim/sim_object.hh" +#include "sim/serialize.hh" VoltageDomain::VoltageDomain(const Params ) : SimObject(p), voltageOpPoints(p.voltage), _perfLevel(0), stats(*this) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38738 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: Ibf314b43a966943a8096958f68382e1e245f29e3 Gerrit-Change-Number: 38738 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Add unit tests for flags.hh
FlagsTest, IsSetValue) +{ +const uint32_t value_a = (1 << 3); +const uint32_t value_b = (1 << 5); +const Flags flags(value_a | value_b); +ASSERT_TRUE(flags.isSet(value_a)); +ASSERT_FALSE(flags.isSet(value_a << 1)); +ASSERT_TRUE(flags.isSet(value_b)); +} + +/** Test isSet comparing against another flag. */ +TEST(FlagsTest, IsSetType) +{ +const uint32_t value_a = (1 << 5) | (1 << 6); +const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9); +const uint32_t value_c = (1 << 4) | (1 << 8); +const Flags flags(value_a); +ASSERT_TRUE(flags.isSet(value_b)); +ASSERT_FALSE(flags.isSet(value_c)); +} + +/** Test if all bits are set with allSet. */ +TEST(FlagsTest, AllSet) +{ +const uint32_t value_b = (1 << 5) | (1 << 6); +const uint32_t value_c = std::numeric_limits::max(); +const Flags flags_a; +const Flags flags_b(value_b); +const Flags flags_c(value_c); +ASSERT_FALSE(flags_a.allSet()); +ASSERT_FALSE(flags_b.allSet()); +ASSERT_TRUE(flags_c.allSet()); +} + +/** Test allSet comparing against another flag. */ +TEST(FlagsTest, AllSetMatch) +{ +const uint32_t value_a = (1 << 5) | (1 << 6); +const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9); +const Flags flags(value_a); +ASSERT_TRUE(flags.allSet(value_a)); +ASSERT_FALSE(flags.allSet(value_b)); +} + +/** Test if no bits are set with noneSet. */ +TEST(FlagsTest, NoneSet) +{ +const uint32_t value_b = (1 << 5) | (1 << 6); +const Flags flags_a; +const Flags flags_b(value_b); +ASSERT_TRUE(flags_a.noneSet()); +ASSERT_FALSE(flags_b.noneSet()); +} + +/** Test noneSet comparing against another flag. */ +TEST(FlagsTest, NoneSetMatch) +{ +const uint32_t value_a = (1 << 5) | (1 << 6); +const uint32_t value_b = (1 << 3) | (1 << 6); +const uint32_t value_c = (1 << 3) | (1 << 4) | (1 << 9); +const Flags flags(value_a); +ASSERT_FALSE(flags.noneSet(value_a)); +ASSERT_FALSE(flags.noneSet(value_b)); +ASSERT_TRUE(flags.noneSet(value_c)); +} + +/** Test if no bits are set after a full clear. */ +TEST(FlagsTest, Clear) +{ +const uint32_t value = (1 << 5) | (1 << 6); +Flags flags(value); +flags.clear(); +ASSERT_TRUE(flags.noneSet()); +} + +/** Test clearing specific bits. */ +TEST(FlagsTest, ClearMatch) +{ +const uint32_t value_a = (1 << 5) | (1 << 6); +const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9); +Flags flags(value_a); +flags.clear(value_b); +ASSERT_FALSE(flags.isSet(value_a & value_b)); +ASSERT_TRUE(flags.isSet(value_a ^ (value_a & value_b))); +} + +/** Test setting with a few overlapping bits. */ +TEST(FlagsTest, SetOverlapping) +{ +const uint32_t value_a = (1 << 5) | (1 << 6); +const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9); +Flags flags(value_a); +flags.set(value_b); +ASSERT_EQ(value_a | value_b, uint32_t(flags)); +} + +/** + * Test conditional set. If true the selected bits are set; otherwise, they + * are cleared. + */ +TEST(FlagsTest, ConditionalSet) +{ +const uint32_t value_a = (1 << 5) | (1 << 6); +const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9); + +Flags flags_true(value_a); +flags_true.set(value_b, true); +ASSERT_EQ(value_a | value_b, uint32_t(flags_true)); + +Flags flags_false(value_a); +flags_false.set(value_b, false); +ASSERT_EQ(value_a & ~value_b, uint32_t(flags_false)); +} + +/** + * Test updating a masked selection of bits. This means that bits of the + * original value that match the mask will be replaced by the bits of + * the new value that match the mask. + */ +TEST(FlagsTest, UpdateOverlapping) +{ +const uint32_t value_a = (1 << 4) | (1 << 5) | (1 << 6); +const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9); +const uint32_t mask = (1 << 4) | (1 << 5) | (1 << 9) | (1 << 10); +// (1 << 4) is set in value_a, but is not set in value_b, so it is cleared +// (1 << 5) is set in both values, so it remains set +// (1 << 9) is not set in value_a, but it is in value_b, so it is set +// (1 << 10) is not set in both values, so it remains not set +const uint32_t result = (1 << 5) | (1 << 6) | (1 << 9); +Flags flags(value_a); +flags.update(value_b, mask); +ASSERT_EQ(result, uint32_t(flags)); +} -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38714 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: I58135b5f2fc016c30e1b4535f3daf46a77e99aff Gerrit-Change-Number: 38714 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Remove dubious/unused Flags functions
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38736 ) Change subject: base: Remove dubious/unused Flags functions .. base: Remove dubious/unused Flags functions The functions isSet(), noneSet(), and allSet() assume that all bits of the underlying container have a corresponding flag. This is typically not true, and the likelihood of incorrectly using these functions is high. Fortunately these functions are not being used anywhere, and can be safely removed. Alternatively, a mask could be provided on construction to determine which bits of the underlying container correspond to a flag bit, so that the proper bits are checked in these functions. Change-Id: Ia7cbfd0726943506a3f04dc417e67a0b57cdbf95 Signed-off-by: Daniel R. Carvalho --- M src/base/flags.hh M src/base/flags.test.cc 2 files changed, 1 insertion(+), 55 deletions(-) diff --git a/src/base/flags.hh b/src/base/flags.hh index 170abc5..6e82210 100644 --- a/src/base/flags.hh +++ b/src/base/flags.hh @@ -72,13 +72,6 @@ } /** - * Verifies whether any bit in the flags is set. - * - * @return True if any flag bit is set; false otherwise. - */ -bool isSet() const { return _flags; } - -/** * Verifies whether any bit matching the given mask is set. * * @param mask The mask containing the bits to verify. @@ -87,13 +80,6 @@ bool isSet(Type mask) const { return (_flags & mask); } /** - * Verifies whether all bits in the flags are set. - * - * @return True if all flag bits are set; false otherwise. - */ -bool allSet() const { return !(~_flags); } - -/** * Verifies whether no bits matching the given mask are set. * * @param mask The mask containing the bits to verify. @@ -102,13 +88,6 @@ bool allSet(Type mask) const { return (_flags & mask) == mask; } /** - * Verifies whether no bits in the flags are set. - * - * @return True if all flag bits are cleared; false otherwise. - */ -bool noneSet() const { return _flags == 0; } - -/** * Verifies whether no bits matching the given mask are set. * * @param mask The mask containing the bits to verify. diff --git a/src/base/flags.test.cc b/src/base/flags.test.cc index 297abc8..c45a7a8 100644 --- a/src/base/flags.test.cc +++ b/src/base/flags.test.cc @@ -99,16 +99,6 @@ ASSERT_EQ(uint32_t(flags_a), uint32_t(flags_b)); } -/** Test isSet for any bit set. */ -TEST(FlagsTest, IsSetAny) -{ -const uint32_t value = (1 << 3); -const Flags flags_a; -const Flags flags_b(value); -ASSERT_FALSE(flags_a.isSet()); -ASSERT_TRUE(flags_b.isSet()); -} - /** Test isSet for multiple bits set. */ TEST(FlagsTest, IsSetValue) { @@ -131,19 +121,6 @@ ASSERT_FALSE(flags.isSet(value_c)); } -/** Test if all bits are set with allSet. */ -TEST(FlagsTest, AllSet) -{ -const uint32_t value_b = (1 << 5) | (1 << 6); -const uint32_t value_c = std::numeric_limits::max(); -const Flags flags_a; -const Flags flags_b(value_b); -const Flags flags_c(value_c); -ASSERT_FALSE(flags_a.allSet()); -ASSERT_FALSE(flags_b.allSet()); -ASSERT_TRUE(flags_c.allSet()); -} - /** Test allSet comparing against another flag. */ TEST(FlagsTest, AllSetMatch) { @@ -154,16 +131,6 @@ ASSERT_FALSE(flags.allSet(value_b)); } -/** Test if no bits are set with noneSet. */ -TEST(FlagsTest, NoneSet) -{ -const uint32_t value_b = (1 << 5) | (1 << 6); -const Flags flags_a; -const Flags flags_b(value_b); -ASSERT_TRUE(flags_a.noneSet()); -ASSERT_FALSE(flags_b.noneSet()); -} - /** Test noneSet comparing against another flag. */ TEST(FlagsTest, NoneSetMatch) { @@ -182,7 +149,7 @@ const uint32_t value = (1 << 5) | (1 << 6); Flags flags(value); flags.clear(); -ASSERT_TRUE(flags.noneSet()); +ASSERT_EQ(0, uint32_t(flags)); } /** Test clearing specific bits. */ -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38736 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: Ia7cbfd0726943506a3f04dc417e67a0b57cdbf95 Gerrit-Change-Number: 38736 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Remove Flags assignment
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38713 ) Change subject: base: Remove Flags assignment .. base: Remove Flags assignment Currently unused and broken. Since these are templated classes, and _flags is private, the assignment is a compilation error. Furthermore, assignment of flags of different types is likely undefined behavior. Change-Id: I8430045c42c003efc74e343cc5b4a4350bc2ad92 Signed-off-by: Daniel R. Carvalho --- M src/base/flags.hh 1 file changed, 0 insertions(+), 11 deletions(-) diff --git a/src/base/flags.hh b/src/base/flags.hh index 505a1e5..8cefd2d 100644 --- a/src/base/flags.hh +++ b/src/base/flags.hh @@ -58,17 +58,6 @@ /** * @ingroup api_flags */ -template -const Flags & -operator=(const Flags ) -{ -_flags = flags._flags; -return *this; -} - -/** - * @ingroup api_flags - */ const Flags & operator=(T flags) { -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38713 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: I8430045c42c003efc74e343cc5b4a4350bc2ad92 Gerrit-Change-Number: 38713 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Assert Flags' type is unsigned
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38712 ) Change subject: base: Assert Flags' type is unsigned .. base: Assert Flags' type is unsigned Operations rely on the use of unsigned integers. Change-Id: I825a88f81b54577585976d6558b1409870897721 Signed-off-by: Daniel R. Carvalho --- M src/base/flags.hh 1 file changed, 4 insertions(+), 0 deletions(-) diff --git a/src/base/flags.hh b/src/base/flags.hh index c9525fa..505a1e5 100644 --- a/src/base/flags.hh +++ b/src/base/flags.hh @@ -29,10 +29,14 @@ #ifndef __BASE_FLAGS_HH__ #define __BASE_FLAGS_HH__ +#include + template class Flags { private: +static_assert(std::is_unsigned::value, "Flag type must be unsigned"); + T _flags; public: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38712 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: I825a88f81b54577585976d6558b1409870897721 Gerrit-Change-Number: 38712 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Add documentation to flags.hh
bits are replaced. + */ void update(Type flags, Type mask) { -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38735 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: I924b1d5c20a3e2066be64ab124ae1a5d96d4b3bf Gerrit-Change-Number: 38735 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Rename Flags::update as Flags::replace
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38737 ) Change subject: base: Rename Flags::update as Flags::replace .. base: Rename Flags::update as Flags::replace The function name `update` is too generic. Given that the expected functionality is to replace the selected flag bits with the bits provided as parameters, rename it as `replace`. Change-Id: Ic7613ae09ecf9b92e31103b4e928192c07e9b640 Signed-off-by: Daniel R. Carvalho --- M src/base/flags.hh M src/base/flags.test.cc 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/base/flags.hh b/src/base/flags.hh index 6e82210..0544380 100644 --- a/src/base/flags.hh +++ b/src/base/flags.hh @@ -135,7 +135,7 @@ * @param mask Mask used to determine which bits are replaced. */ void -update(Type flags, Type mask) +replace(Type flags, Type mask) { _flags = (_flags & ~mask) | (flags & mask); } diff --git a/src/base/flags.test.cc b/src/base/flags.test.cc index c45a7a8..08031b9 100644 --- a/src/base/flags.test.cc +++ b/src/base/flags.test.cc @@ -192,11 +192,11 @@ } /** - * Test updating a masked selection of bits. This means that bits of the + * Test replacing a masked selection of bits. This means that bits of the * original value that match the mask will be replaced by the bits of * the new value that match the mask. */ -TEST(FlagsTest, UpdateOverlapping) +TEST(FlagsTest, ReplaceOverlapping) { const uint32_t value_a = (1 << 4) | (1 << 5) | (1 << 6); const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9); @@ -207,6 +207,6 @@ // (1 << 10) is not set in both values, so it remains not set const uint32_t result = (1 << 5) | (1 << 6) | (1 << 9); Flags flags(value_a); -flags.update(value_b, mask); +flags.replace(value_b, mask); ASSERT_EQ(result, uint32_t(flags)); } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38737 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: Ic7613ae09ecf9b92e31103b4e928192c07e9b640 Gerrit-Change-Number: 38737 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Add unit test for debug.hh
ot;FlagSetClearDebugFlagTestA"); +ASSERT_FALSE(flag_a.status()); + +// Disable and enable a flag +ASSERT_FALSE(flag_b.status()); +clearDebugFlag("FlagSetClearDebugFlagTestB"); +ASSERT_FALSE(flag_b.status()); +setDebugFlag("FlagSetClearDebugFlagTestB"); +ASSERT_TRUE(flag_b.status()); + +// Change a non-existent flag +setDebugFlag("FlagSetClearDebugFlagTestC"); +clearDebugFlag("FlagSetClearDebugFlagTestC"); +} + +/** Test dumping no enabled debug flags. */ +TEST(FlagTest, NoDumpDebugFlags) +{ +Debug::Flag::globalEnable(); +Debug::SimpleFlag flag("FlagDumpDebugFlagTest", ""); + +// Verify that the names of the enabled flags are printed +testing::internal::CaptureStdout(); +dumpDebugFlags(); +std::string output = testing::internal::GetCapturedStdout(); +EXPECT_EQ(output, ""); +ASSERT_FALSE(flag.status()); +} + +/** Test dumping enabled debug flags with a larger set of flags. */ +TEST(FlagTest, DumpDebugFlags) +{ +Debug::Flag::globalEnable(); +Debug::SimpleFlag flag_a("FlagDumpDebugFlagTestA", ""); +Debug::SimpleFlag flag_b("FlagDumpDebugFlagTestB", ""); +Debug::SimpleFlag flag_c("FlagDumpDebugFlagTestC", ""); +Debug::SimpleFlag flag_d("FlagDumpDebugFlagTestD", ""); +Debug::SimpleFlag flag_e("FlagDumpDebugFlagTestE", ""); +Debug::CompoundFlag compound_flag_a("CompoundFlagDumpDebugFlagTestA", "", +{_d}); +Debug::CompoundFlag compound_flag_b("CompoundFlagDumpDebugFlagTestB", "", +{_e}); + +// Enable a few flags +ASSERT_FALSE(flag_a.status()); +ASSERT_FALSE(flag_b.status()); +ASSERT_FALSE(flag_c.status()); + ASSERT_FALSE(flag_d.status()); +ASSERT_FALSE(flag_e.status()); +flag_a.enable(); +flag_c.enable(); +compound_flag_b.enable(); + +// Verify that the names of the enabled flags are printed +testing::internal::CaptureStdout(); +dumpDebugFlags(); +std::string output = testing::internal::GetCapturedStdout(); +EXPECT_EQ(output, "FlagDumpDebugFlagTestA\nFlagDumpDebugFlagTestC\n" \ +"FlagDumpDebugFlagTestE\n"); +} -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38710 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: I1ae7318a043aa9dc479d4f970c1fd6c9946f4357 Gerrit-Change-Number: 38710 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Fix unitialized variable in Flag
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38707 ) Change subject: base: Fix unitialized variable in Flag .. base: Fix unitialized variable in Flag This was unitialized, and was breaking expected values under certain situations. Change-Id: If51ab6ae038c7c397bc83de1c73af348c1db4ef8 Signed-off-by: Daniel R. Carvalho --- M src/base/debug.cc M src/base/debug.hh 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/base/debug.cc b/src/base/debug.cc index 45d9f9d..9cfd45e 100644 --- a/src/base/debug.cc +++ b/src/base/debug.cc @@ -100,6 +100,8 @@ panic("Flag %s already defined!", name); ++allFlagsVersion; + +sync(); } Flag::~Flag() diff --git a/src/base/debug.hh b/src/base/debug.hh index 7cc7137..454152e 100644 --- a/src/base/debug.hh +++ b/src/base/debug.hh @@ -89,7 +89,7 @@ public: SimpleFlag(const char *name, const char *desc) -: Flag(name, desc), _status(false) +: Flag(name, desc), _tracing(false), _status(false) { } bool status() const override { return _tracing; } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38707 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: If51ab6ae038c7c397bc83de1c73af348c1db4ef8 Gerrit-Change-Number: 38707 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Rename Flag status to enabled
.enabled()); EXPECT_TRUE(Debug::changeFlag("FlagChangeFlagTestA", true)); -ASSERT_TRUE(flag_a.status()); +ASSERT_TRUE(flag_a.enabled()); EXPECT_TRUE(Debug::changeFlag("FlagChangeFlagTestA", false)); -ASSERT_FALSE(flag_a.status()); +ASSERT_FALSE(flag_a.enabled()); // Disable and enable a flag -ASSERT_FALSE(flag_b.status()); +ASSERT_FALSE(flag_b.enabled()); EXPECT_TRUE(Debug::changeFlag("FlagChangeFlagTestB", false)); -ASSERT_FALSE(flag_b.status()); +ASSERT_FALSE(flag_b.enabled()); EXPECT_TRUE(Debug::changeFlag("FlagChangeFlagTestB", true)); -ASSERT_TRUE(flag_b.status()); +ASSERT_TRUE(flag_b.enabled()); // Change a non-existent flag ASSERT_FALSE(Debug::changeFlag("FlagChangeFlagTestC", true)); } -/** Test changing flag status with aux functions. */ +/** Test changing flag enabled with aux functions. */ TEST(FlagTest, SetClearDebugFlag) { Debug::Flag::globalEnable(); @@ -228,18 +230,18 @@ Debug::SimpleFlag flag_b("FlagSetClearDebugFlagTestB", ""); // Enable and disable a flag -ASSERT_FALSE(flag_a.status()); +ASSERT_FALSE(flag_a.enabled()); setDebugFlag("FlagSetClearDebugFlagTestA"); -ASSERT_TRUE(flag_a.status()); +ASSERT_TRUE(flag_a.enabled()); clearDebugFlag("FlagSetClearDebugFlagTestA"); -ASSERT_FALSE(flag_a.status()); +ASSERT_FALSE(flag_a.enabled()); // Disable and enable a flag -ASSERT_FALSE(flag_b.status()); +ASSERT_FALSE(flag_b.enabled()); clearDebugFlag("FlagSetClearDebugFlagTestB"); -ASSERT_FALSE(flag_b.status()); +ASSERT_FALSE(flag_b.enabled()); setDebugFlag("FlagSetClearDebugFlagTestB"); -ASSERT_TRUE(flag_b.status()); +ASSERT_TRUE(flag_b.enabled()); // Change a non-existent flag setDebugFlag("FlagSetClearDebugFlagTestC"); @@ -257,7 +259,7 @@ dumpDebugFlags(); std::string output = testing::internal::GetCapturedStdout(); EXPECT_EQ(output, ""); -ASSERT_FALSE(flag.status()); +ASSERT_FALSE(flag.enabled()); } /** Test dumping enabled debug flags with a larger set of flags. */ @@ -275,11 +277,11 @@ {_e}); // Enable a few flags -ASSERT_FALSE(flag_a.status()); -ASSERT_FALSE(flag_b.status()); -ASSERT_FALSE(flag_c.status()); -ASSERT_FALSE(flag_d.status()); -ASSERT_FALSE(flag_e.status()); +ASSERT_FALSE(flag_a.enabled()); +ASSERT_FALSE(flag_b.enabled()); +ASSERT_FALSE(flag_c.enabled()); +ASSERT_FALSE(flag_d.enabled()); +ASSERT_FALSE(flag_e.enabled()); flag_a.enable(); flag_c.enable(); compound_flag_b.enable(); diff --git a/src/python/pybind11/debug.cc b/src/python/pybind11/debug.cc index 84673f1..1284d56 100644 --- a/src/python/pybind11/debug.cc +++ b/src/python/pybind11/debug.cc @@ -94,9 +94,9 @@ .def_property_readonly("desc", ::Flag::desc) .def("enable", ::Flag::enable) .def("disable", ::Flag::disable) -.def_property("status", +.def_property("enabled", [](const Debug::Flag *flag) { - return flag->status(); + return flag->enabled(); }, [](Debug::Flag *flag, bool state) { if (state) { @@ -106,7 +106,7 @@ } }) .def("__bool__", [](const Debug::Flag *flag) { -return flag->status(); +return flag->enabled(); }) ; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38711 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: I8cdd76766d80d65007a9f204abcf71b18211ab42 Gerrit-Change-Number: 38711 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Remove flag from allFlags on destruction
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38709 ) Change subject: base: Remove flag from allFlags on destruction .. base: Remove flag from allFlags on destruction When a flag is destroyed it must be removed from the list containing all flags. Use this opportunity to remove "using namespace std" since it is barely used. Change-Id: I201371a770c56e11b92532e146d577c6ecb29d34 Signed-off-by: Daniel R. Carvalho --- M src/base/debug.cc 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/base/debug.cc b/src/base/debug.cc index 9cfd45e..8eaf2c6 100644 --- a/src/base/debug.cc +++ b/src/base/debug.cc @@ -49,8 +49,6 @@ #include "base/cprintf.hh" #include "base/logging.hh" -using namespace std; - namespace Debug { // @@ -93,8 +91,8 @@ Flag::Flag(const char *name, const char *desc) : _name(name), _desc(desc) { -pair result = -allFlags().insert(make_pair(name, this)); +std::pair result = +allFlags().insert(std::make_pair(name, this)); if (!result.second) panic("Flag %s already defined!", name); @@ -106,7 +104,7 @@ Flag::~Flag() { -// should find and remove flag. +allFlags().erase(name()); } void -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38709 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: I201371a770c56e11b92532e146d577c6ecb29d34 Gerrit-Change-Number: 38709 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Remove negation operator in Flag
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38708 ) Change subject: base: Remove negation operator in Flag .. base: Remove negation operator in Flag There is already a bool conversion operator, so there is no need to provide a negation operator. Change-Id: If5f99f8a0bb1707c115d139417aedd47bd162963 Signed-off-by: Daniel R. Carvalho --- M src/base/debug.hh 1 file changed, 0 insertions(+), 1 deletion(-) diff --git a/src/base/debug.hh b/src/base/debug.hh index 454152e..297c1dd 100644 --- a/src/base/debug.hh +++ b/src/base/debug.hh @@ -73,7 +73,6 @@ virtual bool status() const = 0; operator bool() const { return status(); } -bool operator!() const { return !status(); } static void globalEnable(); static void globalDisable(); -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38708 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: If5f99f8a0bb1707c115d139417aedd47bd162963 Gerrit-Change-Number: 38708 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sim: Make ProbeManager instance a non-pointer
ize(); i++) { -ProbeManager *const mgr(p.manager[i]->getProbeManager()); -mgr->addListener(p.probe_name, +p.manager[i]->getProbeManager().addListener(p.probe_name, new ProbeListenerArgProbePoints::PacketInfo>(this, ::handleRequest)); } diff --git a/src/sim/power/power_model.cc b/src/sim/power/power_model.cc index f3d7353..b5bdf4f 100644 --- a/src/sim/power/power_model.cc +++ b/src/sim/power/power_model.cc @@ -95,7 +95,7 @@ void PowerModel::regProbePoints() { -this->subsystem->getProbeManager()->addListener("thermalUpdate", +this->subsystem->getProbeManager().addListener("thermalUpdate", new ProbeListenerArg(this, ::thermalUpdateCallback)); } diff --git a/src/sim/power/thermal_domain.cc b/src/sim/power/thermal_domain.cc index d3ef028..d742d3d 100644 --- a/src/sim/power/thermal_domain.cc +++ b/src/sim/power/thermal_domain.cc @@ -70,7 +70,7 @@ this->subsystem = ss; ppThermalUpdate = -subsystem->getProbeManager()->addPoint>( +subsystem->getProbeManager().addPoint>( "thermalUpdate"); } diff --git a/src/sim/sim_object.cc b/src/sim/sim_object.cc index e53f498..f495245 100644 --- a/src/sim/sim_object.cc +++ b/src/sim/sim_object.cc @@ -33,7 +33,6 @@ #include "base/match.hh" #include "base/trace.hh" #include "debug/Checkpoint.hh" -#include "sim/probe/probe.hh" using namespace std; @@ -53,20 +52,15 @@ // SimObject constructor: used to maintain static simObjectList // SimObject::SimObject(const Params ) -: EventManager(getEventQueue(p.eventq_index)), - Stats::Group(nullptr), - _params(p) + : EventManager(getEventQueue(p.eventq_index)), +Stats::Group(nullptr), +probeManager(name()), +_params(p) { #ifdef DEBUG doDebugBreak = false; #endif simObjectList.push_back(this); -probeManager = new ProbeManager(name()); -} - -SimObject::~SimObject() -{ -delete probeManager; } void @@ -113,7 +107,7 @@ { } -ProbeManager * +ProbeManager & SimObject::getProbeManager() { return probeManager; diff --git a/src/sim/sim_object.hh b/src/sim/sim_object.hh index a75f8dd..e2aaf05 100644 --- a/src/sim/sim_object.hh +++ b/src/sim/sim_object.hh @@ -54,10 +54,10 @@ #include "sim/drain.hh" #include "sim/eventq.hh" #include "sim/port.hh" +#include "sim/probe/probe.hh" #include "sim/serialize.hh" class EventManager; -class ProbeManager; /** * Abstract superclass for simulation objects. Represents things that @@ -128,7 +128,7 @@ static SimObjectList simObjectList; /** Manager coordinates hooking up probe points with listeners. */ -ProbeManager *probeManager; +ProbeManager probeManager; protected: /** @@ -152,7 +152,7 @@ */ SimObject(const Params &_params); -virtual ~SimObject(); +virtual ~SimObject() = default; public: @@ -219,7 +219,7 @@ * * @ingroup api_simobject */ -ProbeManager *getProbeManager(); +ProbeManager (); /** * Get a port with a given name and index. This is used at binding time -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38705 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: I53e9468f1de9d5b13be986015af0b32729cc482c Gerrit-Change-Number: 38705 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sim: Handle ProbePoint creation with ProbeManager
git a/src/sim/probe/probe.hh b/src/sim/probe/probe.hh index da8bc51..8078a18 100644 --- a/src/sim/probe/probe.hh +++ b/src/sim/probe/probe.hh @@ -68,6 +68,7 @@ #include "base/compiler.hh" #include "base/trace.hh" +#include "debug/ProbeVerbose.hh" #include "sim/sim_object.hh" /** Forward declare the ProbeManager. */ @@ -143,8 +144,8 @@ protected: const std::string name; public: -ProbePoint(ProbeManager *manager, const std::string ); -virtual ~ProbePoint() {} +ProbePoint(const std::string ); +virtual ~ProbePoint() = default; virtual void addListener(ProbeListener *listener) = 0; virtual void removeListener(ProbeListener *listener) = 0; @@ -161,7 +162,7 @@ /** Required for sensible debug messages.*/ M5_CLASS_VAR_USED const SimObject *object; /** Vector for name look-up. */ -std::vector points; +std::vector> points; public: ProbeManager(SimObject *obj) @@ -189,10 +190,30 @@ bool removeListener(std::string point_name, ProbeListener ); /** - * @brief Add a ProbePoint to this SimObject ProbeManager. - * @param point the ProbePoint to add. + * @brief Create and add a ProbePoint to this SimObject's ProbeManager. + * @tparam Arg The type of the ProbePoint. + * @param name The name of the ProbePoint to create. + * @return A pointer to the probe point, so that a cached copy can + * be kept to generate notifications. */ -void addPoint(ProbePoint ); +template + std::shared_ptr +addPoint(const std::string ) +{ +DPRINTFR(ProbeVerbose, "Probes: Call to addPoint \"%s\" to %s.\n", +name, object->name()); + +for (auto p = points.begin(); p != points.end(); ++p) { +if ((*p)->getName() == name) { +DPRINTFR(ProbeVerbose, "Probes: Call to addPoint \"%s\" to %s " +"failed, already added.\n", name, object->name()); +return std::shared_ptr(); +} +} +auto point = std::make_shared(name); +points.push_back(point); +return point; +} }; /** @@ -261,8 +282,8 @@ std::vector *> listeners; public: -ProbePointArg(ProbeManager *manager, std::string name) -: ProbePoint(manager, name) +ProbePointArg(std::string name) +: ProbePoint(name) { } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38698 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: I7e73f34d63f119bdc071c69ecd2de0b63ed109c3 Gerrit-Change-Number: 38698 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: arch-arm: Fix memory leak of PMU events
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38703 ) Change subject: arch-arm: Fix memory leak of PMU events .. arch-arm: Fix memory leak of PMU events Memory of PMU events was never being released. Jira: https://gem5.atlassian.net/browse/GEM5-857 Change-Id: I3cd958310008799f0873af3a490f847a21b5 Signed-off-by: Daniel R. Carvalho --- M src/arch/arm/pmu.cc M src/arch/arm/pmu.hh 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/arch/arm/pmu.cc b/src/arch/arm/pmu.cc index c7489f6..a3f8437 100644 --- a/src/arch/arm/pmu.cc +++ b/src/arch/arm/pmu.cc @@ -39,6 +39,7 @@ #include "arch/arm/isa.hh" #include "arch/arm/utility.hh" +#include "base/compiler.hh" #include "base/trace.hh" #include "cpu/base.hh" #include "debug/Checkpoint.hh" @@ -101,7 +102,7 @@ void PMU::addSoftwareIncrementEvent(unsigned int id) { -auto old_event = eventMap.find(id); +M5_VAR_USED auto old_event = eventMap.find(id); DPRINTF(PMUVerbose, "PMU: Adding SW increment event with id '0x%x'\n", id); if (swIncrementEvent) { @@ -115,8 +116,9 @@ fatal_if(old_event != eventMap.end(), "An event with id %d has " "been previously defined\n", id); -swIncrementEvent = new SWIncrementEvent(); -eventMap[id] = swIncrementEvent; +swIncrementEvent = std::make_shared(); +eventMap[id] = +std::static_pointer_cast(swIncrementEvent); registerEvent(id); } @@ -130,15 +132,11 @@ RegularEvent *event = nullptr; auto event_entry = eventMap.find(id); if (event_entry == eventMap.end()) { - -event = new RegularEvent(); -eventMap[id] = event; - +eventMap[id] = std::make_shared(); +event = static_cast(eventMap[id].get()); } else { -event = dynamic_cast(event_entry->second); -if (!event) { -fatal("Event with id %d is not probe driven\n", id); -} +event = dynamic_cast(event_entry->second.get()); +fatal_if(!event, "Event with id %d is not probe driven\n", id); } event->addMicroarchitectureProbe(obj, probe_name); @@ -179,7 +177,7 @@ counters.emplace_back(*this, index); } -PMUEvent *event = getEvent(cycleCounterEventId); +std::shared_ptr event = getEvent(cycleCounterEventId); panic_if(!event, "core cycle event is not present\n"); cycleCounter.enabled = true; cycleCounter.attach(event); @@ -523,7 +521,7 @@ } void -PMU::CounterState::attach(PMUEvent* event) +PMU::CounterState::attach(const std::shared_ptr ) { if (!resetValue) { value = 0; @@ -726,7 +724,7 @@ cycleCounter.unserializeSection(cp, "cycleCounter"); } -PMU::PMUEvent* +std::shared_ptr PMU::getEvent(uint64_t eventId) { auto entry = eventMap.find(eventId); diff --git a/src/arch/arm/pmu.hh b/src/arch/arm/pmu.hh index 64d3b3d..92c3097 100644 --- a/src/arch/arm/pmu.hh +++ b/src/arch/arm/pmu.hh @@ -388,7 +388,7 @@ * @param the id of the event to obtain * @return a pointer to the event with id eventId */ -PMUEvent* getEvent(uint64_t eventId); +std::shared_ptr getEvent(uint64_t eventId); /** State of a counter within the PMU. **/ struct CounterState : public Serializable { @@ -421,7 +421,7 @@ * * @param the event to attach the counter to */ -void attach(PMUEvent* event); +void attach(const std::shared_ptr ); /** * Obtain the counter id @@ -461,7 +461,7 @@ protected: /* Configuration */ /** PmuEvent currently in use (if any) **/ -PMUEvent *sourceEvent; +std::shared_ptr sourceEvent; /** id of the counter instance **/ uint64_t counterId; @@ -591,7 +591,7 @@ const uint64_t cycleCounterEventId; /** The event that implements the software increment **/ -SWIncrementEvent *swIncrementEvent; +std::shared_ptr swIncrementEvent; protected: /* Configuration and constants */ /** Constant (configuration-dependent) part of the PMCR */ @@ -606,7 +606,7 @@ /** * List of event types supported by this PMU. */ -std::map eventMap; +std::map> eventMap; }; } // namespace ArmISA -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38703 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: I3cd958310008799f0873af3a490f847a21b5 Gerrit-Change-Number: 38703 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: misc: Prefer ProbeListenerArg over ProbeListenerArgBase
/prefetch/pif.cc b/src/mem/cache/prefetch/pif.cc index 2bce80d..487ac52 100644 --- a/src/mem/cache/prefetch/pif.cc +++ b/src/mem/cache/prefetch/pif.cc @@ -128,7 +128,7 @@ } void -PIF::notifyRetiredInst(const Addr pc) +PIF::notifyRetiredInst(const Addr ) { // First access to the prefetcher if (temporalCompactor.size() == 0) { @@ -230,15 +230,10 @@ } void -PIF::PrefetchListenerPC::notify(const Addr& pc) -{ -parent.notifyRetiredInst(pc); -} - -void PIF::addEventProbeRetiredInsts(SimObject *obj, const char *name) { -obj->getProbeManager()->addListener(name, new PrefetchListenerPC(*this)); +obj->getProbeManager()->addListener(name, +new ProbeListenerArg(this, ::notifyRetiredInst)); } } // namespace Prefetcher diff --git a/src/mem/cache/prefetch/pif.hh b/src/mem/cache/prefetch/pif.hh index b1589c5..52eff9f 100644 --- a/src/mem/cache/prefetch/pif.hh +++ b/src/mem/cache/prefetch/pif.hh @@ -152,22 +152,7 @@ * Updates the prefetcher structures upon an instruction retired * @param pc PC of the instruction being retired */ -void notifyRetiredInst(const Addr pc); - -/** - * Probe Listener to handle probe events from the CPU - */ -class PrefetchListenerPC : public ProbeListenerArgBase -{ - public: -PrefetchListenerPC(PIF &_parent) - : ProbeListenerArgBase(), parent(_parent) -{} -void notify(const Addr& pc) override; - - protected: -PIF -}; +void notifyRetiredInst(const Addr ); public: PIF(const PIFPrefetcherParams ); diff --git a/src/mem/probes/base.cc b/src/mem/probes/base.cc index 9b012ee..6fdd588 100644 --- a/src/mem/probes/base.cc +++ b/src/mem/probes/base.cc @@ -52,6 +52,8 @@ for (int i = 0; i < p.manager.size(); i++) { ProbeManager *const mgr(p.manager[i]->getProbeManager()); -mgr->addListener(p.probe_name, new PacketListener(*this)); +mgr->addListener(p.probe_name, +new ProbeListenerArgProbePoints::PacketInfo>(this, +::handleRequest)); } } diff --git a/src/mem/probes/base.hh b/src/mem/probes/base.hh index 18e6855..3264422 100644 --- a/src/mem/probes/base.hh +++ b/src/mem/probes/base.hh @@ -70,24 +70,6 @@ * Callback to analyse intercepted Packets. */ virtual void handleRequest(const ProbePoints::PacketInfo _info) = 0; - - private: -class PacketListener : public ProbeListenerArgBase -{ - public: -PacketListener(BaseMemProbe &_parent) - : ProbeListenerArgBase(), parent(_parent) -{} - -void -notify(const ProbePoints::PacketInfo _info) override -{ -parent.handleRequest(pkt_info); -} - - protected: -BaseMemProbe -}; }; #endif // __MEM_PROBES_BASE_HH__ diff --git a/src/sim/power/power_model.cc b/src/sim/power/power_model.cc index 111d7d8..f3d7353 100644 --- a/src/sim/power/power_model.cc +++ b/src/sim/power/power_model.cc @@ -96,7 +96,8 @@ PowerModel::regProbePoints() { this->subsystem->getProbeManager()->addListener("thermalUpdate", -new ThermalProbeListener(*this)); +new ProbeListenerArg(this, +::thermalUpdateCallback)); } double diff --git a/src/sim/power/power_model.hh b/src/sim/power/power_model.hh index 8362531..2aa6527 100644 --- a/src/sim/power/power_model.hh +++ b/src/sim/power/power_model.hh @@ -128,23 +128,6 @@ void thermalUpdateCallback(const double & temp); protected: -/** Listener class to catch thermal events */ -class ThermalProbeListener : public ProbeListenerArgBase -{ - public: -ThermalProbeListener(PowerModel &_pm) - : ProbeListenerArgBase(), pm(_pm) -{} - -void notify(const double ) -{ -pm.thermalUpdateCallback(temp); -} - - protected: -PowerModel -}; - /** Actual power models (one per power state) */ std::vector states_pm; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38702 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: I93947214c301be95cc27e9f8817ecc99c24f042c Gerrit-Change-Number: 38702 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sim: Move management responsibility from probe listener
e ProbePoint in constructor by - * using the ProbeManager passed in. + * Every new probe listener must be added to the probe manager. */ class ProbeListener { public: -ProbeListener(ProbeManager *manager, const std::string ); -virtual ~ProbeListener(); +ProbeListener() : _enabled(true) {} +virtual ~ProbeListener() = default; ProbeListener(const ProbeListener& other) = delete; ProbeListener& operator=(const ProbeListener& other) = delete; ProbeListener(ProbeListener&& other) noexcept = delete; @@ -143,10 +141,6 @@ */ bool enabled() const { return _enabled; } - protected: -ProbeManager *const manager; -const std::string name; - private: /** Whether this listener processes notifications. */ bool _enabled; @@ -195,7 +189,7 @@ * @param listener the ProbeListener to add. * @return true if added, false otherwise. */ -bool addListener(std::string point_name, ProbeListener ); +bool addListener(std::string point_name, ProbeListener *listener); /** * @brief Remove a ProbeListener from the ProbePoint named by pointName. @@ -205,7 +199,7 @@ * @param listener the ProbeListener to remove. * @return true if removed, false otherwise. */ -bool removeListener(std::string point_name, ProbeListener ); +bool removeListener(std::string point_name, ProbeListener *listener); /** * @brief Create and add a ProbePoint to this SimObject's ProbeManager. @@ -245,9 +239,7 @@ class ProbeListenerArgBase : public ProbeListener { public: -ProbeListenerArgBase(ProbeManager *pm, const std::string ) -: ProbeListener(pm, name) -{} +ProbeListenerArgBase() : ProbeListener() {} virtual void notify(const Arg ) = 0; }; @@ -271,9 +263,8 @@ * @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 , -void (T::* func)(const Arg &)) -: ProbeListenerArgBase(obj->getProbeManager(), name), +ProbeListenerArg(T *obj, void (T::* func)(const Arg &)) +: ProbeListenerArgBase(), object(obj), function(func) {} @@ -297,7 +288,7 @@ class ProbePointArg : public ProbePoint { /** The attached listeners. */ -std::vector *> listeners; +std::vector>> listeners; public: ProbePointArg(std::string name) @@ -322,9 +313,10 @@ addListener(ProbeListener *l) override { // check listener not already added -if (std::find(listeners.begin(), listeners.end(), l) == -listeners.end()) { -listeners.push_back(static_cast *>(l)); +if (listeners.end() == std::find_if(listeners.begin(), listeners.end(), +[l](const std::shared_ptr> ) -> +bool { return listener.get() == l; })) { + listeners.emplace_back(static_cast*>(l)); } } @@ -335,8 +327,9 @@ void removeListener(ProbeListener *l) override { -listeners.erase(std::remove(listeners.begin(), listeners.end(), l), -listeners.end()); +listeners.erase(std::remove_if(listeners.begin(), listeners.end(), +[l](const std::shared_ptr> ) -> +bool { return listener.get() == l; }), listeners.end()); } /** -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38700 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: Ib7d70cb51d346987ba4b0e7f969aa0274f19a3e4 Gerrit-Change-Number: 38700 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sim,arch-arm: Allow enabling and disabling probe listeners
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38699 ) Change subject: sim,arch-arm: Allow enabling and disabling probe listeners .. sim,arch-arm: Allow enabling and disabling probe listeners Let probe listeners be enabled or disabled regarding receiving and processing notifications. Jira: https://gem5.atlassian.net/browse/GEM5-857 Change-Id: Ia8118e6cd28a9bb9683edd4f71aa665e096e08a9 Signed-off-by: Daniel R. Carvalho --- M src/arch/arm/pmu.cc M src/arch/arm/pmu.hh M src/sim/probe/probe.cc M src/sim/probe/probe.hh 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/arch/arm/pmu.cc b/src/arch/arm/pmu.cc index 51dfdca..6de7a8e 100644 --- a/src/arch/arm/pmu.cc +++ b/src/arch/arm/pmu.cc @@ -474,16 +474,17 @@ void PMU::RegularEvent::enable() { -for (auto& subEvents: microArchitectureEventSet) { -attachedProbePointList.emplace_back( -new RegularProbe(this, subEvents.first, subEvents.second)); +for (auto : attachedProbePointList) { +listener->enable(); } } void PMU::RegularEvent::disable() { -attachedProbePointList.clear(); +for (auto : attachedProbePointList) { +listener->disable(); +} } bool diff --git a/src/arch/arm/pmu.hh b/src/arch/arm/pmu.hh index 3cdcf1c..65781b8 100644 --- a/src/arch/arm/pmu.hh +++ b/src/arch/arm/pmu.hh @@ -340,16 +340,15 @@ std::set userCounters; }; -struct RegularEvent : public PMUEvent { -typedef std::pair EventTypeEntry; - -void addMicroarchitectureProbe(SimObject* object, -std::string name) { - +struct RegularEvent : public PMUEvent +{ +void +addMicroarchitectureProbe(SimObject* object, std::string name) +{ panic_if(!object,"malformed probe-point" " definition with name %s\n", name); - -microArchitectureEventSet.emplace(object, name); +attachedProbePointList.emplace_back( +new RegularProbe(this, object, name)); } protected: @@ -368,9 +367,6 @@ RegularEvent *parentEvent; }; -/** The set of events driving the event value **/ -std::set microArchitectureEventSet; - /** Set of probe listeners tapping onto each of the input micro-arch * events which compose this pmu event */ diff --git a/src/sim/probe/probe.cc b/src/sim/probe/probe.cc index c4e74a5..656ea8e 100644 --- a/src/sim/probe/probe.cc +++ b/src/sim/probe/probe.cc @@ -66,7 +66,7 @@ } ProbeListener::ProbeListener(ProbeManager *_manager, const std::string &_name) -: manager(_manager), name(_name) +: manager(_manager), name(_name), _enabled(true) { manager->addListener(name, *this); } diff --git a/src/sim/probe/probe.hh b/src/sim/probe/probe.hh index 8078a18..5c72126 100644 --- a/src/sim/probe/probe.hh +++ b/src/sim/probe/probe.hh @@ -129,9 +129,27 @@ ProbeListener(ProbeListener&& other) noexcept = delete; ProbeListener& operator=(ProbeListener&& other) noexcept = delete; + +/** Allow this probe to receive notifications. */ +void enable() { _enabled = true; } + +/** Disallow this probe to receive notifications. */ +void disable() { _enabled = false; } + +/** + * Whether this listener is allowed to receive notifications. + * + * @return True if this listener can process notifications. + */ +bool enabled() const { return _enabled; } + protected: ProbeManager *const manager; const std::string name; + + private: +/** Whether this listener processes notifications. */ +bool _enabled; }; /** @@ -329,7 +347,9 @@ notify(const Arg ) { for (auto l = listeners.begin(); l != listeners.end(); ++l) { -(*l)->notify(arg); +if ((*l)->enabled()) { +(*l)->notify(arg); +} } } }; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38699 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: Ia8118e6cd28a9bb9683edd4f71aa665e096e08a9 Gerrit-Change-Number: 38699 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: RFC,sim: Remove ProbeListenerObject
regProbePoints followed by regProbeListeners being @@ -71,12 +68,10 @@ #include "base/compiler.hh" #include "base/trace.hh" #include "debug/ProbeVerbose.hh" -#include "sim/sim_object.hh" /** Forward declare the ProbeManager. */ class ProbeManager; class ProbeListener; -class ProbeListenerObjectParams; /** * Name space containing shared probe point declarations. @@ -94,24 +89,6 @@ } /** - * This class is a minimal wrapper around SimObject. It is used to declare - * a python derived object that can be added as a ProbeListener to any other - * SimObject. - * - * It instantiates manager from a call to Parent.any. - */ -class ProbeListenerObject : public SimObject -{ - protected: -ProbeManager *manager; - - public: -ProbeListenerObject(const ProbeListenerObjectParams ); -virtual ~ProbeListenerObject() = default; -ProbeManager* getProbeManager() { return manager; } -}; - -/** * ProbeListener base class; here to simplify things like containers * containing multiple types of ProbeListener. * -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38704 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: I88ad979dbede096f0227cca493769fd9e14e01a5 Gerrit-Change-Number: 38704 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem: Rename BaseMemProbe's manager to objects
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38706 ) Change subject: mem: Rename BaseMemProbe's manager to objects .. mem: Rename BaseMemProbe's manager to objects This is a vector of SimObjects, not a vector of probe managers. Jira: https://gem5.atlassian.net/browse/GEM5-857 Change-Id: Id006c92a4fc30f5c28f6d402ee59f95e180c5598 Signed-off-by: Daniel R. Carvalho --- M src/mem/probes/BaseMemProbe.py M src/mem/probes/base.cc 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mem/probes/BaseMemProbe.py b/src/mem/probes/BaseMemProbe.py index 796ab36..6bd4a83 100644 --- a/src/mem/probes/BaseMemProbe.py +++ b/src/mem/probes/BaseMemProbe.py @@ -42,6 +42,6 @@ abstract = True cxx_header = "mem/probes/base.hh" -manager = VectorParam.SimObject(Parent.any, -"Probe manager(s) to instrument") +objects = VectorParam.SimObject(Parent.any, "SimObject(s) to instrument") +manager = DeprecatedParam(objects, "`manager` is now called objects") probe_name = Param.String("PktRequest", "Memory request probe to use") diff --git a/src/mem/probes/base.cc b/src/mem/probes/base.cc index e2b0c27..c6ae467 100644 --- a/src/mem/probes/base.cc +++ b/src/mem/probes/base.cc @@ -50,8 +50,8 @@ const BaseMemProbeParams = dynamic_cast(params()); -for (int i = 0; i < p.manager.size(); i++) { -p.manager[i]->getProbeManager().addListener(p.probe_name, +for (auto : p.objects) { +object->getProbeManager().addListener(p.probe_name, new ProbeListenerArgProbePoints::PacketInfo>(this, ::handleRequest)); } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38706 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: Id006c92a4fc30f5c28f6d402ee59f95e180c5598 Gerrit-Change-Number: 38706 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sim: Remove SimObject pointer from ProbeManager
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38701 ) Change subject: sim: Remove SimObject pointer from ProbeManager .. sim: Remove SimObject pointer from ProbeManager This pointer is only used to get the SimObject's name for improved debugging messages. This adds an unnecessary dependency, and since the name should not change throughout execution, it can be stored on construction instead. Jira: https://gem5.atlassian.net/browse/GEM5-857 Change-Id: If5647cc657b1a8e68a2cfc3f7d3e944a1104c1d9 Signed-off-by: Daniel R. Carvalho --- M src/sim/probe/probe.cc M src/sim/probe/probe.hh M src/sim/sim_object.cc 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/sim/probe/probe.cc b/src/sim/probe/probe.cc index 01fcc85..bf34632 100644 --- a/src/sim/probe/probe.cc +++ b/src/sim/probe/probe.cc @@ -61,7 +61,7 @@ ProbeManager::addListener(std::string point_name, ProbeListener *listener) { DPRINTFR(ProbeVerbose, "Probes: Call to addListener to \"%s\" on %s.\n", -point_name, object->name()); +point_name, objectName); bool added = false; for (auto p = points.begin(); p != points.end(); ++p) { if ((*p)->getName() == point_name) { @@ -71,7 +71,7 @@ } if (!added) { DPRINTFR(ProbeVerbose, "Probes: Call to addListener to \"%s\" on " -"%s failed, no such point.\n", point_name, object->name()); +"%s failed, no such point.\n", point_name, objectName); } return added; } @@ -80,7 +80,7 @@ ProbeManager::removeListener(std::string point_name, ProbeListener *listener) { DPRINTFR(ProbeVerbose, "Probes: Call to removeListener from \"%s\" on " -"%s.\n", point_name, object->name()); +"%s.\n", point_name, objectName); bool removed = false; for (auto p = points.begin(); p != points.end(); ++p) { if ((*p)->getName() == point_name) { @@ -90,7 +90,7 @@ } if (!removed) { DPRINTFR(ProbeVerbose, "Probes: Call to removeListener from \"%s\" " -"on %s failed, no such point.\n", point_name, object->name()); +"on %s failed, no such point.\n", point_name, objectName); } return removed; } diff --git a/src/sim/probe/probe.hh b/src/sim/probe/probe.hh index 36f5b86..ee532c3 100644 --- a/src/sim/probe/probe.hh +++ b/src/sim/probe/probe.hh @@ -171,16 +171,20 @@ class ProbeManager { private: -/** Required for sensible debug messages.*/ -M5_CLASS_VAR_USED const SimObject *object; +/** + * Name of the object to which this manager belongs. Required for + * sensible debug messages. + */ +M5_CLASS_VAR_USED const std::string objectName; + /** Vector for name look-up. */ std::vector> points; public: -ProbeManager(SimObject *obj) -: object(obj) +ProbeManager(const std::string _name) +: objectName(object_name) {} -virtual ~ProbeManager() {} +virtual ~ProbeManager() = default; /** * @brief Add a ProbeListener to the ProbePoint named by pointName. @@ -213,12 +217,12 @@ addPoint(const std::string ) { DPRINTFR(ProbeVerbose, "Probes: Call to addPoint \"%s\" to %s.\n", -name, object->name()); +name, objectName); for (auto p = points.begin(); p != points.end(); ++p) { if ((*p)->getName() == name) { DPRINTFR(ProbeVerbose, "Probes: Call to addPoint \"%s\" to %s " -"failed, already added.\n", name, object->name()); +"failed, already added.\n", name, objectName); return std::shared_ptr(); } } diff --git a/src/sim/sim_object.cc b/src/sim/sim_object.cc index 58780b2..e53f498 100644 --- a/src/sim/sim_object.cc +++ b/src/sim/sim_object.cc @@ -61,7 +61,7 @@ doDebugBreak = false; #endif simObjectList.push_back(this); -probeManager = new ProbeManager(this); +probeManager = new ProbeManager(name()); } SimObject::~SimObject() -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38701 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: If5647cc657b1a8e68a2cfc3f7d3e944a1104c1d9 Gerrit-Change-Number: 38701 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sim: Align coding style of probes
r. * @param arg the argument to pass to each listener. */ -void notify(const Arg ) +void +notify(const Arg ) { for (auto l = listeners.begin(); l != listeners.end(); ++l) { (*l)->notify(arg); -- 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: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Generate error on compression misconfiguration
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/38635 ) Change subject: mem-cache: Generate error on compression misconfiguration .. mem-cache: Generate error on compression misconfiguration Compressed caches must use the compressed tags, otherwise a seg fault will be generated. Besides, if no compressor is assigned; yet compressed tags are used, data is not compressed. Generate an error for the first case, and a warning for the second. Change-Id: Iac5474ed919163ce38a8c4e8efd9727e5b3d8417 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38635 Reviewed-by: Nikos Nikoleris Maintainer: Nikos Nikoleris Tested-by: kokoro --- M src/mem/cache/base.cc 1 file changed, 7 insertions(+), 0 deletions(-) Approvals: Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc index 5fc3456..3181a0c 100644 --- a/src/mem/cache/base.cc +++ b/src/mem/cache/base.cc @@ -56,6 +56,7 @@ #include "mem/cache/mshr.hh" #include "mem/cache/prefetch/base.hh" #include "mem/cache/queue_entry.hh" +#include "mem/cache/tags/compressed_tags.hh" #include "mem/cache/tags/super_blk.hh" #include "params/BaseCache.hh" #include "params/WriteAllocator.hh" @@ -123,6 +124,12 @@ tags->tagsInit(); if (prefetcher) prefetcher->setCache(this); + +fatal_if(compressor && !dynamic_cast(tags), +"The tags of compressed cache %s must derive from CompressedTags", +name()); +warn_if(!compressor && dynamic_cast(tags), +"Compressed cache %s does not have a compression algorithm", name()); if (compressor) compressor->setCache(this); } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38635 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: Iac5474ed919163ce38a8c4e8efd9727e5b3d8417 Gerrit-Change-Number: 38635 Gerrit-PatchSet: 2 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Nikos Nikoleris Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Generate error on compression misconfiguration
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38635 ) Change subject: mem-cache: Generate error on compression misconfiguration .. mem-cache: Generate error on compression misconfiguration Compressed caches must use the compressed tags, otherwise a seg fault will be generated. Besides, if no compressor is assigned; yet compressed tags are used, data is not compressed. Generate an error for the first case, and a warning for the second. Change-Id: Iac5474ed919163ce38a8c4e8efd9727e5b3d8417 Signed-off-by: Daniel R. Carvalho --- M src/mem/cache/base.cc 1 file changed, 7 insertions(+), 0 deletions(-) diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc index 5fc3456..3181a0c 100644 --- a/src/mem/cache/base.cc +++ b/src/mem/cache/base.cc @@ -56,6 +56,7 @@ #include "mem/cache/mshr.hh" #include "mem/cache/prefetch/base.hh" #include "mem/cache/queue_entry.hh" +#include "mem/cache/tags/compressed_tags.hh" #include "mem/cache/tags/super_blk.hh" #include "params/BaseCache.hh" #include "params/WriteAllocator.hh" @@ -123,6 +124,12 @@ tags->tagsInit(); if (prefetcher) prefetcher->setCache(this); + +fatal_if(compressor && !dynamic_cast(tags), +"The tags of compressed cache %s must derive from CompressedTags", +name()); +warn_if(!compressor && dynamic_cast(tags), +"Compressed cache %s does not have a compression algorithm", name()); if (compressor) compressor->setCache(this); } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38635 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: Iac5474ed919163ce38a8c4e8efd9727e5b3d8417 Gerrit-Change-Number: 38635 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Add a data-update probe to cache
ssert(!pkt->needsResponse()); -pkt->writeDataToBlock(blk->data, blkSize); + +updateBlockData(blk, pkt, has_old_data); DPRINTF(Cache, "%s new state is %s\n", __func__, blk->print()); incHitCount(pkt); @@ -1240,6 +1295,7 @@ // of the block as well. assert(blkSize == pkt->getSize()); +const bool has_old_data = blk && blk->isValid(); if (!blk) { if (pkt->writeThrough()) { // if this is a write through packet, we don't try to @@ -1279,7 +1335,8 @@ } // nothing else to do; writeback doesn't expect response assert(!pkt->needsResponse()); -pkt->writeDataToBlock(blk->data, blkSize); + +updateBlockData(blk, pkt, has_old_data); DPRINTF(Cache, "%s new state is %s\n", __func__, blk->print()); incHitCount(pkt); @@ -1352,6 +1409,7 @@ assert(pkt->isResponse()); Addr addr = pkt->getAddr(); bool is_secure = pkt->isSecure(); +const bool has_old_data = blk && blk->isValid(); #if TRACING_ON const std::string old_state = blk ? blk->print() : ""; #endif @@ -1433,7 +1491,7 @@ assert(pkt->hasData()); assert(pkt->getSize() == blkSize); -pkt->writeDataToBlock(blk->data, blkSize); +updateBlockData(blk, pkt, has_old_data); } // The block will be ready when the payload arrives and the fill is done blk->setWhenReady(clockEdge(fillLatency) + pkt->headerDelay + @@ -1507,6 +1565,9 @@ stats.unusedPrefetches++; } +// Notify that the data contents for this address are no longer present +updateBlockData(blk, nullptr, blk->isValid()); + // If handling a block present in the Tags, let it do its invalidation // process, which will update stats and invalidate the block itself if (blk != tempBlock) { @@ -2325,6 +2386,8 @@ ppHit = new ProbePointArg(this->getProbeManager(), "Hit"); ppMiss = new ProbePointArg(this->getProbeManager(), "Miss"); ppFill = new ProbePointArg(this->getProbeManager(), "Fill"); +ppDataUpdate = +new ProbePointArg(this->getProbeManager(), "Data Update"); } /// diff --git a/src/mem/cache/base.hh b/src/mem/cache/base.hh index 8dad1b7..5342eaa 100644 --- a/src/mem/cache/base.hh +++ b/src/mem/cache/base.hh @@ -108,6 +108,28 @@ NUM_BLOCKED_CAUSES }; +/** + * A data contents update is composed of the updated block's address, + * the old contents, and the new contents. + * @sa ppDataUpdate + */ +struct DataUpdate +{ +/** The updated block's address. */ +Addr addr; +/** Whether the block belongs to the secure address space. */ +bool isSecure; +/** The stale data contents. If zero-sized this update is a fill. */ +std::vector oldData; +/** The new data contents. If zero-sized this is an invalidation. */ +std::vector newData; + +DataUpdate(Addr _addr, bool is_secure) + : addr(_addr), isSecure(is_secure), oldData(), newData() +{ +} +}; + protected: /** @@ -335,6 +357,13 @@ ProbePointArg *ppFill; /** + * To probe when the contents of a block are updated. Content updates + * include data fills, overwrites, and invalidations, which means that + * this probe partially overlaps with other probes. + */ +ProbePointArg *ppDataUpdate; + +/** * The writeAllocator drive optimizations for streaming writes. * It first determines whether a WriteReq MSHR should be delayed, * thus ensuring that we wait longer in cases when we are write @@ -575,6 +604,18 @@ virtual void functionalAccess(PacketPtr pkt, bool from_cpu_side); /** + * Update the data contents of a block. When no packet is provided no + * data will be written to the block, which means that this was likely + * triggered by an invalidation. + * + * @param blk The block being updated. + * @param cpkt The packet containing the new data. + * @param has_old_data Whether this block had data previously. + */ +void updateBlockData(CacheBlk *blk, const PacketPtr cpkt, +bool has_old_data); + +/** * Handle doing the Compare and Swap function for SPARC. */ void cmpAndSwap(CacheBlk *blk, PacketPtr pkt); -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/37096 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: I1ff3c09c63d5402765c2125c4d76d95b614877d6 Gerrit-Change-Number: 37096 Gerrit-PatchSet: 9 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Nikos Nikoleris Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sim: Add a listener checker to probes
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/38175 ) Change subject: sim: Add a listener checker to probes .. sim: Add a listener checker to probes Add a function to check if a probe has listeners. This can be used to avoid performing costly tasks when no one is listening. Change-Id: I8996a0ea298cb7cf97ac8aa9e627331a22bea26e Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38175 Maintainer: Jason Lowe-Power Tested-by: kokoro Reviewed-by: Jason Lowe-Power Reviewed-by: Nikos Nikoleris --- M src/sim/probe/probe.hh 1 file changed, 9 insertions(+), 0 deletions(-) Approvals: Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved Nikos Nikoleris: Looks good to me, approved kokoro: Regressions pass diff --git a/src/sim/probe/probe.hh b/src/sim/probe/probe.hh index 57132fc..5becc26 100644 --- a/src/sim/probe/probe.hh +++ b/src/sim/probe/probe.hh @@ -262,6 +262,15 @@ } /** + * Informs whether any listeners are attached to this probe. This can + * be used to avoid performing costly tasks needed by the probe when + * nobody is listening. + * + * @return Whether this probe has any listener. + */ +bool hasListeners() const { return listeners.size() > 0; } + +/** * @brief adds a ProbeListener to this ProbePoints notify list. * @param l the ProbeListener to add to the notify list. */ -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38175 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: I8996a0ea298cb7cf97ac8aa9e627331a22bea26e Gerrit-Change-Number: 38175 Gerrit-PatchSet: 5 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Nikos Nikoleris Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-ruby: Fix const copy of addr range in AbstractController
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38495 ) Change subject: mem-ruby: Fix const copy of addr range in AbstractController .. mem-ruby: Fix const copy of addr range in AbstractController Clang 10 throws the following error: loop variable 'addr_range' of type 'const AddrRange' creates a copy from type 'const AddrRange' [-Werror,-Wrange-loop-construct] note: use reference type 'const AddrRange &' to prevent copying Issue introduced by c7fabb979c09864ab47ae848381d6797b45a4cc6. Change-Id: I43e8d613eb5069d5ce9cb12ddec18cba0a3847f6 Signed-off-by: Daniel R. Carvalho --- M src/mem/ruby/slicc_interface/AbstractController.cc 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mem/ruby/slicc_interface/AbstractController.cc b/src/mem/ruby/slicc_interface/AbstractController.cc index 1e8d8e0..ba2075a 100644 --- a/src/mem/ruby/slicc_interface/AbstractController.cc +++ b/src/mem/ruby/slicc_interface/AbstractController.cc @@ -87,7 +87,7 @@ for (auto abs_cntrl : params().downstream_destinations) { MachineID mid = abs_cntrl->getMachineID(); const AddrRangeList = abs_cntrl->getAddrRanges(); -for (const auto addr_range : ranges) { +for (const auto _range : ranges) { auto i = downstreamAddrMap.intersects(addr_range); if (i == downstreamAddrMap.end()) { i = downstreamAddrMap.insert(addr_range, AddrMapEntry()); -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38495 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: I43e8d613eb5069d5ce9cb12ddec18cba0a3847f6 Gerrit-Change-Number: 38495 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Fix setting prefetch bit
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/38176 ) Change subject: mem-cache: Fix setting prefetch bit .. mem-cache: Fix setting prefetch bit Commit https://gem5-review.googlesource.com/c/public/gem5/+/35699 had a copy-paste error: when setting the prefetch bit it must become true. Change-Id: Ib0abc5141dd65d3c739dc01948a72eb5451884e8 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38176 Reviewed-by: Nikos Nikoleris Maintainer: Nikos Nikoleris Tested-by: kokoro --- M src/mem/cache/cache_blk.hh 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/mem/cache/cache_blk.hh b/src/mem/cache/cache_blk.hh index 2d866a8..b1038c8 100644 --- a/src/mem/cache/cache_blk.hh +++ b/src/mem/cache/cache_blk.hh @@ -251,7 +251,7 @@ void clearPrefetched() { _prefetched = false; } /** Marks this blocks as a recently prefetched block. */ -void setPrefetched() { _prefetched = false; } +void setPrefetched() { _prefetched = true; } /** * Get tick at which block's data will be available for access. -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38176 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: Ib0abc5141dd65d3c739dc01948a72eb5451884e8 Gerrit-Change-Number: 38176 Gerrit-PatchSet: 2 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Nikos Nikoleris Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Use smart pointer for info's storageParams
@@ void doInit() { -new (storage) Storage(this->info()->storageParams); +new (storage) Storage(this->info()->getStorageParams()); this->setInit(); } @@ -2247,7 +2247,7 @@ prepare() { Info *info = this->info(); -data()->prepare(info->storageParams, info->data); +data()->prepare(info->getStorageParams(), info->data); } /** @@ -2256,7 +2256,7 @@ void reset() { -data()->reset(this->info()->storageParams); +data()->reset(this->info()->getStorageParams()); } }; diff --git a/src/base/stats/info.cc b/src/base/stats/info.cc index b0f777c..ab46199 100644 --- a/src/base/stats/info.cc +++ b/src/base/stats/info.cc @@ -48,6 +48,7 @@ #include "base/cprintf.hh" #include "base/debug.hh" #include "base/logging.hh" +#include "base/stats/storage.hh" #include "base/str.hh" namespace Stats { @@ -97,7 +98,7 @@ } Info::Info() -: flags(none), precision(-1), prereq(0), storageParams(NULL) +: flags(none), precision(-1), prereq(0), storageParams() { id = id_count++; if (debug_break_id >= 0 and debug_break_id == id) @@ -108,6 +109,18 @@ { } +StorageParams const* +Info::getStorageParams() const +{ +return storageParams.get(); +} + +void +Info::setStorageParams(const StorageParams *const params) +{ +return storageParams.reset(params); +} + void Info::setName(const std::string ) { diff --git a/src/base/stats/info.hh b/src/base/stats/info.hh index 632d13c..37921f7 100644 --- a/src/base/stats/info.hh +++ b/src/base/stats/info.hh @@ -88,13 +88,22 @@ static int id_count; int id; - public: -const StorageParams *storageParams; + private: +std::unique_ptr storageParams; public: Info(); virtual ~Info(); +/** + * Getter for the storage params. These parameters should only be modified + * using the respective setter. + * @sa setStorageParams + */ +StorageParams const* getStorageParams() const; +/** Setter for the storage params. */ +void setStorageParams(const StorageParams *const params); + /** Set the name of this statistic */ void setName(const std::string ); void setName(const Group *parent, const std::string ); -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38178 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: I4c2496d08241f155793ed35e3463512d9ea06f83 Gerrit-Change-Number: 38178 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Fix update of useful prefetches
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38177 ) Change subject: mem-cache: Fix update of useful prefetches .. mem-cache: Fix update of useful prefetches The probe notification must be parsed on every hit, even if the prefetcher is set not to generate prefetches on accesses. This fixes the calculation of useful prefetches. Change-Id: Iff298f7bea11013f411f4ba39dba705fd81a0cd4 Signed-off-by: Daniel R. Carvalho --- M src/mem/cache/prefetch/base.cc 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/mem/cache/prefetch/base.cc b/src/mem/cache/prefetch/base.cc index 28aaa62..5a34ac6 100644 --- a/src/mem/cache/prefetch/base.cc +++ b/src/mem/cache/prefetch/base.cc @@ -125,6 +125,7 @@ bool read = pkt->isRead(); bool inv = pkt->isInvalidate(); +if (!miss && prefetchOnAccess) return false; if (pkt->req->isUncacheable()) return false; if (fetch && !onInst) return false; if (!fetch && !onData) return false; @@ -236,10 +237,8 @@ true)); listeners.push_back(new PrefetchListener(*this, pm, "Fill", true, false)); -if (prefetchOnAccess) { -listeners.push_back(new PrefetchListener(*this, pm, "Hit", false, - false)); -} +listeners.push_back(new PrefetchListener(*this, pm, "Hit", false, + false)); } } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38177 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: Iff298f7bea11013f411f4ba39dba705fd81a0cd4 Gerrit-Change-Number: 38177 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Fix setting prefetch bit
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38176 ) Change subject: mem-cache: Fix setting prefetch bit .. mem-cache: Fix setting prefetch bit Commit https://gem5-review.googlesource.com/c/public/gem5/+/35699 had a copy-paste error: when setting the prefetch bit it must become true. Change-Id: Ib0abc5141dd65d3c739dc01948a72eb5451884e8 Signed-off-by: Daniel R. Carvalho --- M src/mem/cache/cache_blk.hh 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mem/cache/cache_blk.hh b/src/mem/cache/cache_blk.hh index 2d866a8..b1038c8 100644 --- a/src/mem/cache/cache_blk.hh +++ b/src/mem/cache/cache_blk.hh @@ -251,7 +251,7 @@ void clearPrefetched() { _prefetched = false; } /** Marks this blocks as a recently prefetched block. */ -void setPrefetched() { _prefetched = false; } +void setPrefetched() { _prefetched = true; } /** * Get tick at which block's data will be available for access. -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38176 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: Ib0abc5141dd65d3c739dc01948a72eb5451884e8 Gerrit-Change-Number: 38176 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: sim: Add a listener checker to probes
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/38175 ) Change subject: sim: Add a listener checker to probes .. sim: Add a listener checker to probes Add a function to check if a probe has listeners. This can be used to avoid performing costly tasks when no one is listening. Change-Id: I8996a0ea298cb7cf97ac8aa9e627331a22bea26e Signed-off-by: Daniel R. Carvalho --- M src/sim/probe/probe.hh 1 file changed, 9 insertions(+), 0 deletions(-) diff --git a/src/sim/probe/probe.hh b/src/sim/probe/probe.hh index 57132fc..5becc26 100644 --- a/src/sim/probe/probe.hh +++ b/src/sim/probe/probe.hh @@ -262,6 +262,15 @@ } /** + * Informs whether any listeners are attached to this probe. This can + * be used to avoid performing costly tasks needed by the probe when + * nobody is listening. + * + * @return Whether this probe has any listener. + */ +bool hasListeners() const { return listeners.size() > 0; } + +/** * @brief adds a ProbeListener to this ProbePoints notify list. * @param l the ProbeListener to add to the notify list. */ -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38175 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: I8996a0ea298cb7cf97ac8aa9e627331a22bea26e Gerrit-Change-Number: 38175 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Change invalidate signature to not const
mem/cache/replacement_policies/second_chance_rp.cc @@ -52,7 +52,7 @@ void SecondChance::invalidate( -const std::shared_ptr& replacement_data) const +const std::shared_ptr& replacement_data) { FIFO::invalidate(replacement_data); diff --git a/src/mem/cache/replacement_policies/second_chance_rp.hh b/src/mem/cache/replacement_policies/second_chance_rp.hh index 6b7551f..ad38d4c 100644 --- a/src/mem/cache/replacement_policies/second_chance_rp.hh +++ b/src/mem/cache/replacement_policies/second_chance_rp.hh @@ -95,7 +95,7 @@ * @param replacement_data Replacement data to be invalidated. */ void invalidate(const std::shared_ptr& replacement_data) - const override; + override; /** * Touch an entry to update its re-insertion tick and second chance bit. diff --git a/src/mem/cache/replacement_policies/tree_plru_rp.cc b/src/mem/cache/replacement_policies/tree_plru_rp.cc index e5cd978..45c4cfc 100644 --- a/src/mem/cache/replacement_policies/tree_plru_rp.cc +++ b/src/mem/cache/replacement_policies/tree_plru_rp.cc @@ -105,8 +105,7 @@ } void -TreePLRU::invalidate( -const std::shared_ptr& replacement_data) const +TreePLRU::invalidate(const std::shared_ptr& replacement_data) { // Cast replacement data std::shared_ptr treePLRU_replacement_data = diff --git a/src/mem/cache/replacement_policies/tree_plru_rp.hh b/src/mem/cache/replacement_policies/tree_plru_rp.hh index df4af57..bbf5e07 100644 --- a/src/mem/cache/replacement_policies/tree_plru_rp.hh +++ b/src/mem/cache/replacement_policies/tree_plru_rp.hh @@ -172,7 +172,7 @@ * @param replacement_data Replacement data to be invalidated. */ void invalidate(const std::shared_ptr& replacement_data) - const override; + override; /** * Touch an entry to update its replacement data. diff --git a/src/mem/cache/replacement_policies/weighted_lru_rp.cc b/src/mem/cache/replacement_policies/weighted_lru_rp.cc index 2e44d8d..51c1027 100644 --- a/src/mem/cache/replacement_policies/weighted_lru_rp.cc +++ b/src/mem/cache/replacement_policies/weighted_lru_rp.cc @@ -109,8 +109,8 @@ } void -WeightedLRU::invalidate(const std::shared_ptr& -replacement_data) const +WeightedLRU::invalidate( +const std::shared_ptr& replacement_data) { // Reset last touch timestamp std::static_pointer_cast( diff --git a/src/mem/cache/replacement_policies/weighted_lru_rp.hh b/src/mem/cache/replacement_policies/weighted_lru_rp.hh index 941bb0d..66f587f 100644 --- a/src/mem/cache/replacement_policies/weighted_lru_rp.hh +++ b/src/mem/cache/replacement_policies/weighted_lru_rp.hh @@ -73,7 +73,8 @@ * @param replacement_data Replacement data to be invalidated. */ void invalidate(const std::shared_ptr& replacement_data) - const override; + override; + /** * Touch an entry to update its replacement data. * Sets its last touch tick as the current tick. -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38115 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: I7f5086795dbb93a6fab2b4994c757d509d782d79 Gerrit-Change-Number: 38115 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Add Signature-Based Hit Predictor replacement policy
ased Hit Predictor for High Performance Caching", by + * Wu et al. + */ + +#ifndef __MEM_CACHE_REPLACEMENT_POLICIES_SHIP_RP_HH__ +#define __MEM_CACHE_REPLACEMENT_POLICIES_SHIP_RP_HH__ + +#include + +#include "base/sat_counter.hh" +#include "mem/cache/replacement_policies/brrip_rp.hh" +#include "mem/packet.hh" + +struct SHiPRPParams; +struct SHiPMemRPParams; +struct SHiPPCRPParams; + +namespace ReplacementPolicy { + +class SHiP : public BRRIP +{ + protected: +typedef std::size_t SignatureType; + +/** SHiP-specific implementation of replacement data. */ +class SHiPReplData : public BRRIPReplData +{ + private: +/** Signature that caused the insertion of this entry. */ +SignatureType signature; + +/** Outcome of insertion; set to one if entry is re-referenced. */ +bool outcome; + + public: +SHiPReplData(int num_bits); + +/** Get entry's signature. */ +SignatureType getSignature() const; + +/** + * Set this entry's signature and reset outcome. + * + * @param signature New signature value/ + */ +void setSignature(SignatureType signature); + +/** Set that this entry has been re-referenced. */ +void setReReferenced(); + +/** + * Get whether entry has been re-referenced since insertion. + * + * @return True if entry has been re-referenced since insertion. + */ +bool wasReReferenced() const; +}; + +/** + * Saturation percentage at which an entry starts being inserted as + * intermediate re-reference. + */ +const double insertionThreshold; + +/** + * Signature History Counter Table; learns the re-reference behavior + * of a signature. A zero entry provides a strong indication that + * future lines brought by that signature will not receive any hits. + */ +std::vector SHCT; + +/** + * Extract signature from packet. + * + * @param pkt The packet to extract a signature from. + * @return The signature extracted. + */ +virtual SignatureType getSignature(const PacketPtr pkt) const = 0; + + public: +typedef SHiPRPParams Params; +SHiP(const Params ); +~SHiP() = default; + +/** + * Invalidate replacement data to set it as the next probable victim. + * Updates predictor and invalidate data. + * + * @param replacement_data Replacement data to be invalidated. + */ +void invalidate(const std::shared_ptr& replacement_data) + override; + +/** + * Touch an entry to update its replacement data. + * Updates predictor and assigns RRPV values of Table 3. + * + * @param replacement_data Replacement data to be touched. + * @param pkt Packet that generated this hit. + */ +void touch(const std::shared_ptr& replacement_data, +const PacketPtr pkt) override; +void touch(const std::shared_ptr& replacement_data) const +override; + +/** + * Reset replacement data. Used when an entry is inserted. + * Updates predictor and assigns RRPV values of Table 3. + * + * @param replacement_data Replacement data to be reset. + * @param pkt Packet that generated this miss. + */ +void reset(const std::shared_ptr& replacement_data, +const PacketPtr pkt) override; +void reset(const std::shared_ptr& replacement_data) const +override; + +/** + * Instantiate a replacement data entry. + * + * @return A shared pointer to the new replacement data. + */ +std::shared_ptr instantiateEntry() override; +}; + +/** SHiP that Uses memory addresses as signatures. */ +class SHiPMem : public SHiP +{ + protected: +SignatureType getSignature(const PacketPtr pkt) const override; + + public: +SHiPMem(const SHiPMemRPParams ); +~SHiPMem() = default; +}; + +/** SHiP that Uses PCs as signatures. */ +class SHiPPC : public SHiP +{ + private: +/** Signature to be used when no PC is provided in an access. */ +const SignatureType NO_PC_SIGNATURE = 0; + + protected: +SignatureType getSignature(const PacketPtr pkt) const override; + + public: +SHiPPC(const SHiPPCRPParams ); +~SHiPPC() = default; +}; + +} // namespace ReplacementPolicy + +#endif // __MEM_CACHE_REPLACEMENT_POLICIES_SHIP_RP_HH__ -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38118 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: I44f00d26eab4c96c9c5bc29740862a87356d30d1 Gerrit-Change-Number: 38118 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Use PacketPtr in tags's accessBlock
ride; +CacheBlk* accessBlock(const PacketPtr pkt, Cycles ) override; /** * Find the block in the cache, do not update the replacement data. diff --git a/src/mem/cache/tags/sector_tags.cc b/src/mem/cache/tags/sector_tags.cc index ff2f4a4..f0229bf 100644 --- a/src/mem/cache/tags/sector_tags.cc +++ b/src/mem/cache/tags/sector_tags.cc @@ -136,9 +136,9 @@ } CacheBlk* -SectorTags::accessBlock(Addr addr, bool is_secure, Cycles ) +SectorTags::accessBlock(const PacketPtr pkt, Cycles ) { -CacheBlk *blk = findBlock(addr, is_secure); +CacheBlk *blk = findBlock(pkt->getAddr(), pkt->isSecure()); // Access all tags in parallel, hence one in each way. The data side // either accesses all blocks in parallel, or one block sequentially on diff --git a/src/mem/cache/tags/sector_tags.hh b/src/mem/cache/tags/sector_tags.hh index 5c228ee..87594ec 100644 --- a/src/mem/cache/tags/sector_tags.hh +++ b/src/mem/cache/tags/sector_tags.hh @@ -134,12 +134,11 @@ * access and should only be used as such. Returns the tag lookup latency * as a side effect. * - * @param addr The address to find. - * @param is_secure True if the target memory space is secure. + * @param pkt The packet holding the address to find. * @param lat The latency of the tag lookup. * @return Pointer to the cache block if found. */ -CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles ) override; +CacheBlk* accessBlock(const PacketPtr pkt, Cycles ) override; /** * Insert the new block into the cache and update replacement data. -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38116 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: I201884a6d60e3299fc3c9befebbb2e8b64a007f0 Gerrit-Change-Number: 38116 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Allow sending packet information to replacement policy
mem/cache/tags/base_set_assoc.hh index 07e19a5..38baa6d 100644 --- a/src/mem/cache/tags/base_set_assoc.hh +++ b/src/mem/cache/tags/base_set_assoc.hh @@ -143,7 +143,7 @@ blk->increaseRefCount(); // Update replacement data of accessed block -replacementPolicy->touch(blk->replacementData); +replacementPolicy->touch(blk->replacementData, pkt); } // The tag lookup latency is the same for a hit or a miss @@ -195,7 +195,7 @@ stats.tagsInUse++; // Update replacement policy -replacementPolicy->reset(blk->replacementData); +replacementPolicy->reset(blk->replacementData, pkt); } void moveBlock(CacheBlk *src_blk, CacheBlk *dest_blk) override; diff --git a/src/mem/cache/tags/sector_tags.cc b/src/mem/cache/tags/sector_tags.cc index f0229bf..980bcf3 100644 --- a/src/mem/cache/tags/sector_tags.cc +++ b/src/mem/cache/tags/sector_tags.cc @@ -163,7 +163,7 @@ // Update replacement data of accessed block, which is shared with // the whole sector it belongs to -replacementPolicy->touch(sector_blk->replacementData); +replacementPolicy->touch(sector_blk->replacementData, pkt); } // The tag lookup latency is the same for a hit or a miss @@ -183,14 +183,14 @@ // sector was not previously present in the cache. if (sector_blk->isValid()) { // An existing entry's replacement data is just updated -replacementPolicy->touch(sector_blk->replacementData); +replacementPolicy->touch(sector_blk->replacementData, pkt); } else { // Increment tag counter stats.tagsInUse++; assert(stats.tagsInUse.value() <= numSectors); // A new entry resets the replacement data -replacementPolicy->reset(sector_blk->replacementData); +replacementPolicy->reset(sector_blk->replacementData, pkt); } // Do common block insertion functionality -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38117 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: I412eee09efa2f3511ca1ece76fc2732509df4745 Gerrit-Change-Number: 38117 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Change ReplacementCandidates type
std::shared_ptr victim_replacement_data = -std::static_pointer_cast( - victim->replacementData); +victim->getReplacementData(); if (candidate_replacement_data->last_occ_ptr < victim_replacement_data->last_occ_ptr) { -victim = candidate; +victim = } else if (candidate_replacement_data->last_occ_ptr == victim_replacement_data->last_occ_ptr) { // Evict the block with a smaller tick. Tick time = candidate_replacement_data->last_touch_tick; if (time < victim_replacement_data->last_touch_tick) { -victim = candidate; +victim = } } } -return victim; +return victim->getEntry(); } std::shared_ptr diff --git a/src/mem/cache/replacement_policies/weighted_lru_rp.hh b/src/mem/cache/replacement_policies/weighted_lru_rp.hh index 71156d3..941bb0d 100644 --- a/src/mem/cache/replacement_policies/weighted_lru_rp.hh +++ b/src/mem/cache/replacement_policies/weighted_lru_rp.hh @@ -107,8 +107,8 @@ * @param candidates Replacement candidates, selected by indexing policy. * @return Replacement entry to be replaced. */ -ReplaceableEntry* getVictim(const ReplacementCandidates& - candidates) const override; +ReplaceableEntry* getVictim(ReplacementCandidates& candidates) const + override; }; } // namespace ReplacementPolicy -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/37896 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: Ic945c23dca236d22217984fc010c5c4c80c877dd Gerrit-Change-Number: 37896 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Add the DRRIP replacement policy
Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/37898 ) Change subject: mem-cache: Add the DRRIP replacement policy .. mem-cache: Add the DRRIP replacement policy Instantiate the Dynamic Re-Reference Interval Prediction, as defined in "High Performance Cache Replacement Using Re-Reference Interval Prediction (RRIP)", by Jaleel et al. Change-Id: Id1d354c01e63ae49739263647ff25e5665f60d8c Signed-off-by: Daniel R. Carvalho --- M src/mem/cache/replacement_policies/ReplacementPolicies.py 1 file changed, 4 insertions(+), 0 deletions(-) diff --git a/src/mem/cache/replacement_policies/ReplacementPolicies.py b/src/mem/cache/replacement_policies/ReplacementPolicies.py index 14ce51e..22b85b0 100644 --- a/src/mem/cache/replacement_policies/ReplacementPolicies.py +++ b/src/mem/cache/replacement_policies/ReplacementPolicies.py @@ -100,6 +100,10 @@ class RRIPRP(BRRIPRP): btp = 100 +class DRRIPRP(DuelingRP): +replacement_policy_a = BRRIPRP() +replacement_policy_b = RRIPRP() + class NRURP(BRRIPRP): btp = 100 num_bits = 1 -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/37898 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: Id1d354c01e63ae49739263647ff25e5665f60d8c Gerrit-Change-Number: 37898 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Creation of dueling classes
nt_samples_true, expected_num_samples); +} + +/** Test winner selection with multiple different threshold configurations. */ +TEST_P(DuelingMonitorTest, WinnerSelection) +{ +SatCounter32 expected_selector(numBits); +expected_selector.saturate(); +expected_selector >>= 1; + +// Initialize entries, and save a pointer to a sample of each +// team, and one no sample +int team_true_index = -1; +int team_false_index = -1; +int no_sample_index = -1; +for (int index = 0; index < entries.size(); index++) { +bool team; +if (entries[index].isSample(1ULL << monitor_id, team)) { +if (team) { +team_true_index = index; +} else { +team_false_index = index; +} +} else { +no_sample_index = index; +} +} +ASSERT_TRUE(team_true_index >= 0); +ASSERT_TRUE(team_false_index >= 0); + +// Duel for team true only. If the monitor starts predicting false +// the threshold to use is the higher one. Otherwise, we should +// start expecting true to be the winner, and thus we use the +// low threshold +bool current_winner = monitor->getWinner(); +double threshold = current_winner ? lowThreshold : highThreshold; +for (; expected_selector.calcSaturation() < 1.0; +expected_selector++) { +ASSERT_EQ(expected_selector.calcSaturation() >= threshold, +monitor->getWinner()); +monitor->sample([team_true_index]); +} +current_winner = monitor->getWinner(); +ASSERT_TRUE(current_winner); + +// Duel for no sample. Should not change winner +if (no_sample_index >= 0) { +for (int i = 0; i < 200; i++) { +monitor->sample([no_sample_index]); +} +ASSERT_EQ(current_winner, monitor->getWinner()); +} + +// Duel for team false only. Now that we know that team true +// is winning, the low threshold must be passed in order to +// make team false win the duel +threshold = lowThreshold; +for (; expected_selector.calcSaturation() > 0.0; +expected_selector--) { +ASSERT_EQ(expected_selector.calcSaturation() >= threshold, +monitor->getWinner()); +monitor->sample([team_false_index]); +} +current_winner = monitor->getWinner(); +ASSERT_FALSE(current_winner); + +// Duel for no sample. Should not change winner +if (no_sample_index >= 0) { +for (int i = 0; i < 200; i++) { +monitor->sample([no_sample_index]); +} +ASSERT_EQ(current_winner, monitor->getWinner()); +} +} + +// Test a few possible parameter combinations. Cannot test more +// because of the static limit of number of monitors. If a new test +// is added, make sure to remove an old test +INSTANTIATE_TEST_CASE_P(DuelingMonitorTests, DuelingMonitorTest, +::testing::Values( +// Combinations of constituencies and teams +std::make_tuple(32, 2, 1, 1, 0.5, 0.5), +std::make_tuple(32, 4, 1, 1, 0.5, 0.5), +std::make_tuple(32, 4, 2, 1, 0.5, 0.5), +std::make_tuple(32, 8, 1, 1, 0.5, 0.5), +std::make_tuple(32, 8, 2, 1, 0.5, 0.5), +std::make_tuple(32, 8, 4, 1, 0.5, 0.5), +std::make_tuple(32, 16, 1, 1, 0.5, 0.5), +std::make_tuple(32, 16, 2, 1, 0.5, 0.5), +std::make_tuple(32, 16, 4, 1, 0.5, 0.5), +std::make_tuple(32, 16, 8, 1, 0.5, 0.5), + +// Tests for the thresholds +std::make_tuple(16, 4, 1, 3, 0.5, 0.5), +std::make_tuple(16, 4, 1, 3, 0.1, 0.7), +std::make_tuple(16, 4, 1, 3, 0.4, 0.6), +std::make_tuple(16, 4, 1, 3, 0.8, 0.9), + +// Test for larger tables +std::make_tuple(2048, 32, 4, 4, 0.4, 0.6)) +); -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/37895 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: I692a3e5e0ad98581d68167ad7e6b45ab2f4c7b10 Gerrit-Change-Number: 37895 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Implement a dueling Replacement Policy
ons are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __MEM_CACHE_REPLACEMENT_POLICIES_DUELING_RP_HH__ +#define __MEM_CACHE_REPLACEMENT_POLICIES_DUELING_RP_HH__ + +#include + +#include "base/dueling.hh" +#include "base/statistics.hh" +#include "mem/cache/replacement_policies/base.hh" + +struct DuelingRPParams; + +namespace ReplacementPolicy { + +/** + * This replacement policy duels two replacement policies to find out which + * one provides the best results. A policy is said to have the best results + * when it has a lower number of misses. + */ +class Dueling : public Base +{ + protected: +/** + * Dueler-specific implementation of replacement data. Contains all + * sub-replacement policies' replacement data. + */ +struct DuelerReplData : ReplacementData, Dueler +{ +std::shared_ptr replDataA; +std::shared_ptr replDataB; + +/** Default constructor. Initialize sub-replacement data. */ +DuelerReplData(const std::shared_ptr& repl_data_a, +const std::shared_ptr& repl_data_b) + : ReplacementData(), Dueler(), replDataA(repl_data_a), +replDataB(repl_data_b) +{ +} +}; + +/** Sub-replacement policy used in this multiple container. */ +Base* const replPolicyA; +/** Sub-replacement policy used in this multiple container. */ +Base* const replPolicyB; + +/** + * A dueling monitor that decides which is the best sub-policy based on + * their number of misses. + */ +mutable DuelingMonitor duelingMonitor; + +mutable struct DuelingStats : public Stats::Group +{ +DuelingStats(Stats::Group* parent); + +/** Number of times A was selected on victimization. */ +Stats::Scalar selectedA; + +/** Number of times B was selected on victimization. */ +Stats::Scalar selectedB; +} duelingStats; + +ReplaceableEntry* getVictim(ReplacementCandidates& candidates) const + override; + + public: +typedef DuelingRPParams Params; +Dueling(const Params ); +~Dueling() = default; + +void invalidate(const std::shared_ptr& replacement_data) + const override; +void touch(const std::shared_ptr& replacement_data) const + override; +void reset(const std::shared_ptr& replacement_data) const + override; +ReplaceableEntry* getVictim( +const std::vector& candidates) const override; +std::shared_ptr instantiateEntry() override; +}; + +} // namespace ReplacementPolicy + +#endif // __MEM_CACHE_REPLACEMENT_POLICIES_DUELING_RP_HH__ -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/37897 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: I6a6e96a9388cce8f8c8cd7b9c1dbe9f0554ccc64 Gerrit-Change-Number: 37897 Gerrit-PatchSet: 1 Gerrit-Owner: Daniel Carvalho Gerrit-MessageType: newchange ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: base: Templatize SatCounter
* @ingroup api_sat_counter */ -SatCounter +GenericSatCounter operator--(int) { -SatCounter old_counter = *this; +GenericSatCounter old_counter = *this; --*this; return old_counter; } @@ -207,7 +210,7 @@ * * @ingroup api_sat_counter */ -SatCounter& +GenericSatCounter& operator>>=(const int& shift) { assert(shift >= 0); @@ -220,7 +223,7 @@ * * @ingroup api_sat_counter */ -SatCounter& +GenericSatCounter& operator<<=(const int& shift) { assert(shift >= 0); @@ -236,8 +239,8 @@ * * @ingroup api_sat_counter */ -SatCounter& -operator+=(const int& value) +GenericSatCounter& +operator+=(const long long& value) { if (value >= 0) { if (maxVal - this->counter >= value) { @@ -256,8 +259,8 @@ * * @ingroup api_sat_counter */ -SatCounter& -operator-=(const int& value) +GenericSatCounter& +operator-=(const long long& value) { if (value >= 0) { if (this->counter > value) { @@ -276,7 +279,7 @@ * * @ingroup api_sat_counter */ -operator uint8_t() const { return counter; } +operator T() const { return counter; } /** * Reset the counter to its initial value. @@ -320,9 +323,21 @@ } private: -uint8_t initialVal; -uint8_t maxVal; -uint8_t counter; +T initialVal; +T maxVal; +T counter; }; +/** @ingroup api_sat_counter + * @{ + */ +typedef GenericSatCounter SatCounter8; +typedef GenericSatCounter SatCounter16; +typedef GenericSatCounter SatCounter32; +typedef GenericSatCounter SatCounter64; +/** @} */ + +[[deprecated("Use SatCounter8 (or variants) instead")]] +typedef SatCounter8 SatCounter; + #endif // __BASE_SAT_COUNTER_HH__ diff --git a/src/base/sat_counter.test.cc b/src/base/sat_counter.test.cc index 214b015..4d400c0 100644 --- a/src/base/sat_counter.test.cc +++ b/src/base/sat_counter.test.cc @@ -360,3 +360,98 @@ ASSERT_EQ(counter, value); } +/** Test max and min when using SatCounter16. */ +TEST(SatCounterTest, Size16) +{ +const uint16_t bits_16 = 9; +const uint16_t max_value_16 = (1 << bits_16) - 1; +SatCounter16 counter_16(bits_16); + +// Increasing +counter_16++; +ASSERT_EQ(counter_16, 1); +counter_16 <<= 1; +ASSERT_EQ(counter_16, 2); +counter_16 += 2 * max_value_16; +ASSERT_EQ(counter_16, max_value_16); +counter_16++; +ASSERT_EQ(counter_16, max_value_16); +counter_16 <<= 1; +ASSERT_EQ(counter_16, max_value_16); + +// Decreasing +counter_16--; +ASSERT_EQ(counter_16, max_value_16 - 1); +counter_16 >>= 1; +ASSERT_EQ(counter_16, (max_value_16 - 1) >> 1); +counter_16 -= 2 * max_value_16; +ASSERT_EQ(counter_16, 0); +counter_16--; +ASSERT_EQ(counter_16, 0); +counter_16 >>= 1; +ASSERT_EQ(counter_16, 0); +} + +/** Test max and min when using SatCounter32. */ +TEST(SatCounterTest, Size32) +{ +const uint32_t bits_32 = 17; +const uint32_t max_value_32 = (1 << bits_32) - 1; +SatCounter32 counter_32(bits_32); + +// Increasing +counter_32++; +ASSERT_EQ(counter_32, 1); +counter_32 <<= 1; +ASSERT_EQ(counter_32, 2); +counter_32 += 2 * max_value_32; +ASSERT_EQ(counter_32, max_value_32); +counter_32++; +ASSERT_EQ(counter_32, max_value_32); +counter_32 <<= 1; +ASSERT_EQ(counter_32, max_value_32); + +// Decreasing +counter_32--; +ASSERT_EQ(counter_32, max_value_32 - 1); +counter_32 >>= 1; +ASSERT_EQ(counter_32, (max_value_32 - 1) >> 1); +counter_32 -= 2 * max_value_32; +ASSERT_EQ(counter_32, 0); +counter_32--; +ASSERT_EQ(counter_32, 0); +counter_32 >>= 1; +ASSERT_EQ(counter_32, 0); +} + +/** Test max and min when using SatCounter64. */ +TEST(SatCounterTest, Size64) +{ +const uint64_t bits_64 = 33; +const uint64_t max_value_64 = (1ULL << bits_64) - 1; +SatCounter64 counter_64(bits_64); + +// Increasing +counter_64++; +ASSERT_EQ(counter_64, 1); +counter_64 <<= 1; +ASSERT_EQ(counter_64, 2); +counter_64 += max_value_64; +ASSERT_EQ(counter_64, max_value_64); +counter_64++; +ASSERT_EQ(counter_64, max_value_64); +counter_64 <<= 1; +ASSERT_EQ(counter_64, max_value_64); + +// Decreasing +counter_64--; +ASSERT_EQ(counter_64, max_value_64 - 1); +counter_64 >>= 1; +ASSERT_EQ(counter_64, (max_value_64 - 1) >> 1); +counter_64 -= max_value_64; +ASSERT_EQ(counter_64, 0); +counter_64--; +ASSERT_EQ(counter_64, 0); +counter_64 >>= 1; +ASSERT_EQ(counter_64, 0); +} -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/3
[gem5-dev] Change in gem5/gem5[develop]: base,cpu,mem: Use templatized SatCounter
ce) +Stride::StrideEntry::StrideEntry(const SatCounter8& init_confidence) : TaggedEntry(), confidence(init_confidence) { invalidate(); diff --git a/src/mem/cache/prefetch/stride.hh b/src/mem/cache/prefetch/stride.hh index 982f33e..36fc194 100644 --- a/src/mem/cache/prefetch/stride.hh +++ b/src/mem/cache/prefetch/stride.hh @@ -91,7 +91,7 @@ { protected: /** Initial confidence counter value for the pc tables. */ -const SatCounter initConfidence; +const SatCounter8 initConfidence; /** Confidence threshold for prefetch generation. */ const double threshConf; @@ -124,13 +124,13 @@ /** Tagged by hashed PCs. */ struct StrideEntry : public TaggedEntry { -StrideEntry(const SatCounter& init_confidence); +StrideEntry(const SatCounter8& init_confidence); void invalidate() override; Addr lastAddr; int stride; -SatCounter confidence; +SatCounter8 confidence; }; typedef AssociativeSet PCTable; std::unordered_map pcTables; diff --git a/src/mem/cache/replacement_policies/brrip_rp.hh b/src/mem/cache/replacement_policies/brrip_rp.hh index a9ddfe4..4ed8ca5 100644 --- a/src/mem/cache/replacement_policies/brrip_rp.hh +++ b/src/mem/cache/replacement_policies/brrip_rp.hh @@ -72,7 +72,7 @@ * max_RRPV-1 -> long re-rereference interval * max_RRPV -> distant re-rereference interval */ -SatCounter rrpv; +SatCounter8 rrpv; /** Whether the entry is valid. */ bool valid; -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/37095 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: Ie943c553dd8a8c24c80e737783708b033ce001da Gerrit-Change-Number: 37095 Gerrit-PatchSet: 6 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Andreas Sandberg Gerrit-Reviewer: Bobby R. Bruce Gerrit-Reviewer: Ciro Santilli Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Gabe Black Gerrit-Reviewer: Giacomo Travaglini Gerrit-Reviewer: Hoa Nguyen Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Matthew Poremba Gerrit-Reviewer: Nikos Nikoleris Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
[gem5-dev] Change in gem5/gem5[develop]: mem-cache: Override print function of sector and super blocks
Daniel Carvalho has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/36582 ) Change subject: mem-cache: Override print function of sector and super blocks .. mem-cache: Override print function of sector and super blocks Pass management of printing sector and super block's contents to them. Change-Id: Ided8d404450a0fa39127ac7d2d6578d95691f509 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/36582 Reviewed-by: Nikos Nikoleris Maintainer: Nikos Nikoleris Tested-by: kokoro --- M src/mem/cache/tags/compressed_tags.cc M src/mem/cache/tags/sector_blk.cc M src/mem/cache/tags/sector_blk.hh M src/mem/cache/tags/super_blk.cc M src/mem/cache/tags/super_blk.hh 5 files changed, 30 insertions(+), 6 deletions(-) Approvals: Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/mem/cache/tags/compressed_tags.cc b/src/mem/cache/tags/compressed_tags.cc index f71deda..33d822a 100644 --- a/src/mem/cache/tags/compressed_tags.cc +++ b/src/mem/cache/tags/compressed_tags.cc @@ -150,12 +150,8 @@ assert(!victim->isValid()); // Print all co-allocated blocks -DPRINTF(CacheComp, "Co-Allocation: offset %d with blocks\n", offset); -for (const auto& blk : victim_superblock->blks){ -if (blk->isValid()) { -DPRINTFR(CacheComp, "\t[%s]\n", blk->print()); -} -} +DPRINTF(CacheComp, "Co-Allocation: offset %d of %s\n", offset, +victim_superblock->print()); } // Update number of sub-blocks evicted due to a replacement diff --git a/src/mem/cache/tags/sector_blk.cc b/src/mem/cache/tags/sector_blk.cc index f738e02..c1c5f6a 100644 --- a/src/mem/cache/tags/sector_blk.cc +++ b/src/mem/cache/tags/sector_blk.cc @@ -150,3 +150,16 @@ blk->setPosition(set, way); } } + +std::string +SectorBlk::print() const +{ +std::string sub_blk_print; +for (const auto& sub_blk : blks) { +if (sub_blk->isValid()) { +sub_blk_print += "\t[" + sub_blk->print() + "]\n"; +} +} +return csprintf("%s valid sub-blks (%d):\n%s", +TaggedEntry::print(), getNumValid(), sub_blk_print); +} diff --git a/src/mem/cache/tags/sector_blk.hh b/src/mem/cache/tags/sector_blk.hh index 049f49b..ba32450 100644 --- a/src/mem/cache/tags/sector_blk.hh +++ b/src/mem/cache/tags/sector_blk.hh @@ -177,6 +177,13 @@ * @param way The way of this entry and sub-entries. */ void setPosition(const uint32_t set, const uint32_t way) override; + +/** + * Print relevant information for this sector block and its sub-blocks. + * + * @return A string with the contents of the sector block. + */ +std::string print() const override; }; #endif //__MEM_CACHE_TAGS_SECTOR_BLK_HH__ diff --git a/src/mem/cache/tags/super_blk.cc b/src/mem/cache/tags/super_blk.cc index d81cbc3..9a1de45 100644 --- a/src/mem/cache/tags/super_blk.cc +++ b/src/mem/cache/tags/super_blk.cc @@ -236,3 +236,9 @@ compressionFactor = compression_factor; } } + +std::string +SuperBlk::print() const +{ +return csprintf("CF: %d %s", getCompressionFactor(), SectorBlk::print()); +} diff --git a/src/mem/cache/tags/super_blk.hh b/src/mem/cache/tags/super_blk.hh index d98c14e..64d73bd 100644 --- a/src/mem/cache/tags/super_blk.hh +++ b/src/mem/cache/tags/super_blk.hh @@ -236,6 +236,8 @@ void setCompressionFactor(const uint8_t compression_factor); void invalidate() override; + +std::string print() const override; }; #endif //__MEM_CACHE_TAGS_SUPER_BLK_HH__ -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/36582 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: Ided8d404450a0fa39127ac7d2d6578d95691f509 Gerrit-Change-Number: 36582 Gerrit-PatchSet: 4 Gerrit-Owner: Daniel Carvalho Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Nikos Nikoleris Gerrit-Reviewer: kokoro Gerrit-MessageType: merged ___ gem5-dev mailing list -- gem5-dev@gem5.org To unsubscribe send an email to gem5-dev-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s