I am trying to find which processes are causing context switches within my application. Google returned this guide:
https://www.brendangregg.com/perf.html#SchedulerAnalysis
Great? I run it, but it doesn't work:
sudo perf record ./Test
[ perf record: Captured and wrote 1.438 MB perf.data (37217 samples) ]
perf sched latency
perf: 'sched' is not a perf-command. See 'perf --help'.
What's going wrong?

I think Ubuntu doesn't build
perfwith many dependencies included. For example,perf schedandperf record -e [software tracepoint]requirelibtraceevent. Ubuntu has chose to disable those features rather than adopt the dependency.I'm also on Ubuntu 22.04, and
perf scheddoes not work, nor does my earlier suggestionperf record -e sched:sched_switch.That being said, you can download the kernel source and build
perfyourself. I had to installlibelf-devandlibtraceevent-devin order forperfto be able to provide the above two functions./usr/src/.Afterwards, you should have a new
perfbinary in[some-working-directory]/install/bin. There are probably some caveats for how to make use of it properly from that location, but just running it seems to work for basic use.