Skip to content

Conversation

@teubert
Copy link
Contributor

@teubert teubert commented Jul 30, 2020

No description provided.

@teubert teubert requested a review from jason-watkins July 30, 2020 16:42
@teubert teubert added A: Load Estimation Area: Load Estimation C: Cleanup Category: PRs that clean code up or issues documenting cleanup. E: Medium Call for participation: Experience needed to fix: Medium / intermediate PR: Delete Branch The PR's source branch should be deleted on merge PR: Merge The PR should be merged as soon as all checks have passed. S: Waiting on Review Status: The PR is awaiting review. labels Jul 30, 2020
inc/Exceptions.h Outdated
/** @brief Defines a type of object to be thrown as exception. It reports
* errors that are due to out of range element access
*/
class OutOfRangeError : public std::out_of_range {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a benefit to this over throwing std::out_of_range directly?


uint32_t nElements = config.getUInt32(LOADING_LEN_KEY);

profile.resize(nElements);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To minimize the unnecessary construction of temporary elements, use profile.reserve(nElements) here and profile.emplace_back(duration_s, inputs) inside the loop.

}

LoadEstimator::LoadEstimate ProfileLoadEstimator::estimateLoad(const double t_s) {
const static double startT_s = t_s;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is doing what it's supposed to. This creates a single startT_s variable shared by all instances of the class. Should be replaced double and bool member variable.

void registerConstLoadEstimatorTests(TestContext& context);
void registerGaussianLoadEstimatorTests(TestContext& context);
void registerMovingAverageLoadEstimatorTests(TestContext& context);
void profileTest() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the sake of consistency, shouldn't this go in its own file like all of the other individual tests?

@jason-watkins jason-watkins added S: Waiting on Author Status: The PR is awaiting some action (such as code changes) from the author. and removed S: Waiting on Review Status: The PR is awaiting review. labels Jul 30, 2020
@jason-watkins jason-watkins merged commit ac6b500 into develop Jul 30, 2020
@jason-watkins jason-watkins added S: Merged Status: The PR has been merged and removed S: Waiting on Author Status: The PR is awaiting some action (such as code changes) from the author. labels Jul 30, 2020
@jason-watkins jason-watkins deleted the Feature/ProfileLoadEstimator branch July 30, 2020 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A: Load Estimation Area: Load Estimation C: Cleanup Category: PRs that clean code up or issues documenting cleanup. E: Medium Call for participation: Experience needed to fix: Medium / intermediate PR: Delete Branch The PR's source branch should be deleted on merge PR: Merge The PR should be merged as soon as all checks have passed. S: Merged Status: The PR has been merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants