perf-event
perf-event copied to clipboard
Add riscv64 binding
This PR add perf-even-open-sys riscv64 binding. Binding is generated from Arch Linux RISC-V with kernel headers 6.0.9 on SiFive Unmatched RISC-V board. Build verfied on SiFive Unmatched RISC-V board.
Signed-off-by: Avimitin [email protected]
I am wondering when this PR can be merged. I tested this PR because I happened to measuredd some IPC numbers on SiFive Unmatched board, and it reports same result as using perf.
I tried this PR on a VisionFive2 board from StarFive, and could not get any of the examples to work.
I built a project with the println.rs example and got this when running:
Error: Os { code: 22, kind: InvalidInput, message: "Invalid argument" }
This happens on line: let mut counter = Builder::new().build()?;
I'm new to this so I would need help with pointers on where to look how to debug this.
I'm on: Linux ubuntu 6.2.0-19-generic #19.1-Ubuntu SMP Fri Mar 31 12:41:53 UTC 2023 riscv64 riscv64 riscv64 GNU/Linux
@matsbror My experience with Unmatched is that we cannot use group, and you have to also include OS when running perf, because at present its PMU cannot tell the user space instructions or kernel space instructions.
and you have to also include OS when running perf, because at present its PMU cannot tell the user space instructions or kernel space instructions.
I'm not sure I understand what you mean by "also include OS when running perf". Can you elaborate?
It's unfortunate that I cannot use group, but the example I was running did not use Group.
and you have to also include OS when running perf, because at present its PMU cannot tell the user space instructions or kernel space instructions.
I'm not sure I understand what you mean by "also include OS when running perf". Can you elaborate?
It's unfortunate that I cannot use group, but the example I was running did not use Group.
Yes. In my case, I need to call include_kernel and include_hv when building the counter:
let mut total_inst = Builder::new()
.include_kernel()
.include_hv()
.kind(events::Hardware::INSTRUCTIONS)
.any_pid()
.one_cpu(1)
.build()
.unwrap();
These functions are not available for the crate in crates.rs, but is available in current repository. Hope this is helpful.
Thanks, this was indeed helpful. I tried using Group and all counters returned 0. Do you have any idea why groups cannot be used?
Thanks, this was indeed helpful. I tried using Group and all counters returned 0. Do you have any idea why groups cannot be used?
I have no idea. Maybe the board does not have hardware support to read multiple counters atomically.
By trial and error I found that Groups does wok for my board. I just need to be careful which counters I am using. It works apparently only for the ones supported in hardware.