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

Sensor does not work when built from source despite working with .deb installation #25

Closed
jack-leyland opened this issue Jun 27, 2022 · 2 comments

Comments

@jack-leyland
Copy link

Thanks for the work on this project. I am trying to add some functionality to the sensor for a project of mine, however, I am unable to sucessfully run the sensor when compiling from source even before making any changes. This is puzzling as the sensor works perfectly when install the .deb package on Ubuntu LTS 20.04 and run it that way. I am not using docker.

The sensor outputs the following:
E: 22-06-27 10:33:14 config: event 'TSC' is invalid or unsupported by this machine
E: 22-06-27 10:33:14 config: failed to parse the provided config file

I have identified the issue as being the pfm_get_os_event_encoding() function from libpfm in events.c. It consistently returns a PFM_ERR_NOTFOUND for both msr and rapl events in the config file that I know exist in my architecture (Haswell). All events appear as expected using "perf list."

I have attempted building directly from the source of the latest release to no avail. Might you have any ideas as to why this may be happening, given that the sensor runs successfully and is able to find these events when the sensor installed from the .deb package?

@jack-leyland
Copy link
Author

A little more digging around has yeiled a solution. As this issue appears to have come up before for others I will detail the steps taken to fix (note this applies only to local builds, I have not attempted to run the sensor in a container):

As mentioned in #1, the sensor only seems to function with a patched version of libpfm4 that support certain events, including "TSC", "APERF" and "MPERF." The working patch is available on the smartwatts branch of https://github.com/gfieni/libpfm4.git and must be installed locally from there.

I echo PierreRust's comment in #1 that it would be be helpful to include the correct libpfm patch in the repo and the build pipeline to allow a more seamless local build process.

@gfieni
Copy link
Collaborator

gfieni commented Jun 27, 2022

Hello,
You can find the procedure to build the sensor along the patched libpfm4 inside the Dockerfile.
As you can see in the branch name, this is a patch made specifically for the SmartWatts formula.
The main build pipeline of this project is the Dockerfile, and building the patched libpfm4 is already done there.
I agree that this issue is confusing, and it will be addressed in the future with a better documentation for the build process.

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

2 participants