jlfwong / speedscope

🔬 A fast, interactive web-based viewer for performance profiles.
https://www.speedscope.app
MIT License
5.59k stars 246 forks source link

Weird behavior importing perf data #387

Closed edmcman closed 2 years ago

edmcman commented 2 years ago

I just used speedscope to open a perf recording. The results are not very helpful:

image

The file starts with a few blocks like these that are apparently of the perf command itself:

perf 18021   663.145048:          1 cycles: 
        ffffffffa5e76a8a [unknown] ([unknown])
        ffffffffa5e0d66d [unknown] ([unknown])
        ffffffffa5e0d6b0 [unknown] ([unknown])
        ffffffffa5e078dc [unknown] ([unknown])
        ffffffffa600a926 [unknown] ([unknown])
        ffffffffa6015302 [unknown] ([unknown])
        ffffffffa60e77f2 [unknown] ([unknown])
        ffffffffa615beaf [unknown] ([unknown])
        ffffffffa60e5601 [unknown] ([unknown])
        ffffffffa60e6856 [unknown] ([unknown])
        ffffffffa60e6c09 [unknown] ([unknown])
        ffffffffa5e04207 [unknown] ([unknown])
        ffffffffa6a0008c [unknown] ([unknown])
            7f91ec896ae7 [unknown] ([unknown])

Then the file switches to snapshots of my program (driver):

driver 18021   663.145133:     209655 cycles: 
        ffffffffa606e8c5 [unknown] ([unknown])
        ffffffffa60e4fc3 [unknown] ([unknown])
        ffffffffa615bf09 [unknown] ([unknown])
        ffffffffa60e5601 [unknown] ([unknown])
        ffffffffa60e6856 [unknown] ([unknown])
        ffffffffa60e6c09 [unknown] ([unknown])
        ffffffffa5e04207 [unknown] ([unknown])
        ffffffffa6a0008c [unknown] ([unknown])
            7f91ec896ae7 [unknown] ([unknown])

driver 18021   663.145375:    1332411 cycles: 
            7f9253f90d4a strlen+0x2a (/lib/x86_64-linux-gnu/ld-2.27.so)

If I manually remove the perf blocks, the file imports as expected:

image

bjorn3 commented 2 years ago

At the top center of the the page there is a menu that allows you to select which thread to show. In the first screenshot it shows two threads. That single perf sample and likely your own process. In the second screenshot it only lists your process. As for why that perf block exists in the first place I'm not sure. I have never seen it locally. I would guess it is a bug either in your kernel or perf.

edmcman commented 2 years ago

Thanks, didn't notice that I could select the thread.

I agree this sort of seems like a perf bug, but I haven't really used it before.