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 loading of Linux perf JSON #64

Merged
merged 3 commits into from
May 24, 2021
Merged

Conversation

ludocode
Copy link

This adds support for loading up a perf trace in JSON format.

Linux perf is a profiling tool that does CPU sampling. It's part of the Linux kernel. The goal of this work is to add support to gpuvis to show perf samples alongside a GPU trace so you can see both CPU and GPU events in sync.

I've added support to Linux perf for exporting a trace to JSON. This allows transferring the data over to gpuvis on Windows. The patch is merged in the Linux 5.13 kernel. For earlier kernel versions you have to patch perf manually. The patch is included in this PR in the patches/ folder.

This code loads up the exported perf trace and shows the results in gpuvis. Currently it just shows each sample as an instantaneous event. Later on we can add support for showing a histogram of samples, timeboxing them, drawing a flamegraph, etc.

This adds a dependency on RapidJSON. Rather then committing it to this repository like the other dependencies here, I've opted to fetch it at build time. I added code to the Makefile and to the CMake buildsystem to do this. I haven't set up the Meson buildsystem for this yet. The code is only enabled if HAVE_RAPIDJSON is defined so the project still builds without it.

Nicholas Fraser added 3 commits May 24, 2021 11:09
A patch has been added to patches/ to add JSON export support to perf.
The resulting JSON file can then be loaded into gpuvis on any platform.
Samples are displayed as zero-duration events in the gpuvis timeline.

This introduces a dependency on RapidJSON fetched at build time.
Currently only the Makefile buildsystem supports JSON. Other
buildsystems need to be modified to fetch it and pass the appropriate
preprocessor defines.

Signed-off-by: Nicholas Fraser <nfraser@codeweavers.com>
This parses the new callchain array in the latest perf JSON. Only the
top stack entry is used; the rest is currently ignored.

This also adds downloading of RapidJSON to the CMake buildsystem.
This updates the patch to match the one actually committed to the Linux
kernel.
@mikesart mikesart merged commit 0eeb7f8 into mikesart:master May 24, 2021
@mikesart
Copy link
Owner

Very cool. Thanks Nicholas!

@dorindabassey
Copy link
Collaborator

dorindabassey commented Jan 26, 2022

Rather then committing it to this repository like the other dependencies here, I've opted to fetch it at build time.

@ludocode Might I ask, why did you choose to do this? is a specific rapidjson commit required to build the Makefile? I ask this because I was about to add the rapidjson dependency in the Meson buildsystem same way other dependencies were added. Thanks.

dorindabassey pushed a commit to dorindabassey/gpuvis that referenced this pull request Jan 26, 2022
this RapidJSON dependency added in the Meson Build is needed for loading
of Linux perf JSON. see reference - mikesart#64

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
dorindabassey pushed a commit to dorindabassey/gpuvis that referenced this pull request Jan 26, 2022
this RapidJSON dependency added in the Meson Build is needed for loading
of Linux perf JSON. see reference - mikesart#64

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
dorindabassey pushed a commit to dorindabassey/gpuvis that referenced this pull request Jan 26, 2022
this RapidJSON dependency added in the Meson Build is needed for loading
of Linux perf JSON. see reference - mikesart#64

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
mikesart pushed a commit that referenced this pull request Feb 11, 2022
this RapidJSON dependency added in the Meson Build is needed for loading
of Linux perf JSON. see reference - #64

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
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.

3 participants