pervognsen ,
@pervognsen@mastodon.social avatar

I was trying to find whatever perf_event crate for Rust actually has support for more events and features of the underlying API and perf_event2 looks like a winner. Just browsing through the code, the fact you have an easy API to hook up hardware breakpoints (exec/read/write) to perf counters looks pretty dang nice: https://github.com/Phantomical/perf-event/blob/master/perf-event/src/events/breakpoint.rs#L21

pervognsen OP ,
@pervognsen@mastodon.social avatar

I assume x86 didn't get a way to hook up hardware perf counters to hardware breakpoints while I wasn't looking? I'm assuming the counting is implemented via interrupt handlers in the kernel in which case it's going to be very slow.

pkhuong ,

@pervognsen Worse than that: it's a completely different perf subsystem, so you have to look for a HW event triggered by the breakpoint interrupt handler.

OTOT, there are HW perf triggers that are very unlikely to be hit by regular code (x87, far branches ;), if you're ok with instrumentation.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • tech
  • kbinEarth
  • testing
  • interstellar
  • wanderlust
  • All magazines