-
Notifications
You must be signed in to change notification settings - Fork 6
Add Stats Level config value for use with stats counter collection. #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,27 @@ Environment::get<bool>(const char *key) | |
| return std::nullopt; | ||
| } | ||
|
|
||
| template <> | ||
| std::optional<int> | ||
| Environment::get<int>(const char *key) | ||
| { | ||
| const char *value{Context<Sys>::get()->getenv(key)}; | ||
| if (value == nullptr) | ||
| return std::nullopt; | ||
| errno = 0; | ||
| char *end; | ||
| int x{static_cast<int>(std::strtol(value, &end, 10))}; | ||
|
||
| if (errno != 0) | ||
| return std::nullopt; | ||
| if (end == nullptr) | ||
| return std::nullopt; | ||
|
Comment on lines
+43
to
+44
|
||
| if (end == value) | ||
| return std::nullopt; | ||
| if (*end != '\0') | ||
| return std::nullopt; | ||
| return x; | ||
| } | ||
|
Comment on lines
+31
to
+50
|
||
|
|
||
| optional<bool> | ||
| Environment::allow_compat_mode() | ||
| { | ||
|
|
@@ -39,3 +60,9 @@ Environment::force_compat_mode() | |
| { | ||
| return Environment::get<bool>(Environment::FORCE_COMPAT_MODE); | ||
| } | ||
|
|
||
| optional<int> | ||
| Environment::stats_level() | ||
| { | ||
| return Environment::get<int>(Environment::STATS_LEVEL); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
statsLevel()as a pure virtual method toIConfigurationmakesMConfigurationintest/amd_detail/mconfiguration.habstract and unusable, since that mock does not yet provide aMOCK_METHODforstatsLevel(). WhileMConfigurationis not currently used in any test.cppfile, it will fail to compile if it ever gets included. TheMConfigurationmock should be updated to addMOCK_METHOD(int, statsLevel, (), (const, noexcept, override));.