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

Add flag to skip execution of workload #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

UsualSpec
Copy link
Contributor

@UsualSpec UsualSpec commented Apr 26, 2024

Currently the -c option does not (reliably) support execution of pinpoint without a workload. It is still useful to get data from pinpoint without a workload - especially if just getting the raw data of a power-meter is the goal like in a project I am working on. This PR introduces a -n flag to skip the need of a workload.

pinpoint -c -e CPU - was initially used to execute without a workload. However, I think this is a bug and not really a supported feature. Moreover, this command does not reliably run forever: Sometimes it terminates immediately which I think is due to a race condition related to not having a valid workload.

Alternatively, the -c command could be updated to have different semantics if no workload is given.

This change needs an entry in the README file, but #13 should probably be merged first.

Currently the `-c` option does not (reliably) support execution of pinpoint without a workload. It is still useful to get data from pinpoint without a workload - especially if just getting the raw data of a powermeter is the goal.
sampler.start(std::max(-settings::before, std::chrono::milliseconds(0)));
waitpid(workload, NULL, 0);
std::promise<void>().get_future().wait(); // waits forever
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not optimal in my opinion, but I think waiting forever here is needed due to the program design.

See: https://stackoverflow.com/a/42644441

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alternatively, we could use the syscall pause(): https://man7.org/linux/man-pages/man2/pause.2.html it seems - if we can rely on that syscall existing.

@@ -133,7 +139,7 @@ void readProgArgs(int argc, char *argv[])
}
}

if (!(optind < argc)) {
if (!(optind < argc) || no_workload_flag) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hope that this doesn't cause any buggy behavior.

exit(1);
}

if (!workload_and_args && !(no_workload_flag && continuous_print_flag)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this error message needs to be improved. I needed quite some time to understand what this means. This should hint at the -h option at least.

@tzwenn
Copy link
Member

tzwenn commented Jul 16, 2024

My approach to this was calling pinpoint -c -- read so far.
I'll look into it.

@UsualSpec
Copy link
Contributor Author

UsualSpec commented Jul 17, 2024

Yes, that’s an option probably. But it also feels hacky. I‘d prefer not to fork a process if it’s not needed.

As context: We are using our fork of pinpoint to get data from power meters in our application (https://github.com/nsg-ethz/autopower/blob/956049c2fef02fe1763eb596110164ac253092c1/client/client.cc#L225) and write the measurements into a database.

There are multiple small changes (Build for Raspberry Pi, printing measurement samples to stdout reverting parts of 84c59ab) with this being one of the earliest ones. Should I open an issue on those changes?

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

Successfully merging this pull request may close these issues.

None yet

2 participants