Skip to content
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

Measurement data collection stops short of needed amount. #168

Open
huburb4n opened this issue Dec 11, 2024 · 0 comments
Open

Measurement data collection stops short of needed amount. #168

huburb4n opened this issue Dec 11, 2024 · 0 comments

Comments

@huburb4n
Copy link

When the collected parameters count exceeds a certain size, powertop stops collecting data.

The compile time constants below, defined in parameters.h

#define MAX_KEEP 700
#define MAX_PARAM 750

are used in persistent.ccp in
void load_results(const char *filename)
to limit the amount of results loaded into "past_results"

			overflow_index = 50 + (rand() % MAX_KEEP);
			if (past_results.size() >= MAX_PARAM) {
			/* memory leak, must free old one first */
				past_results[overflow_index] = bundle;
			} else {
				past_results.push_back(bundle);
			}

However, in parameters.cpp in
int global_power_valid(void)
there is a condition which dynamically defines the desired number of measurements as a function of parameters size:

	if (past_results.size() > 3 * all_parameters.parameters.size())
		return 1;

without any consideration for the relation between MAX_PARAM and the calculated value.

Potential fixes:

  • accept MAX_PARAM measurements regardless of the parameter count
	if (past_results.size() > min(3 * all_parameters.parameters.size(), MAX_PARAM-1))
		return 1;
  • or increase the storage limits to
#define MAX_KEEP 974
#define MAX_PARAM 1024

This last approach allows powertop to finish its data collection and continue normally on my test platform where
the number of measurements needed is displayed as 907.

  • or any other approach which takes into account the relationship illustrated above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant