1 of 20

Profiling rust

Alexandru Ene

2 of 20

About me

3 of 20

What to expect

  • Intro about profilers
  • What is hawktracer?
  • What is hawktracer_rust?
  • How it works?
  • LiveDemo (what can go wrong?)
  • Questions

4 of 20

5 of 20

Profiler Types

  • Sampling profilers
  • Intrusive profilers

6 of 20

Sampling Profilers

  • Easy to use
  • I have tried CodeXL, VerySleepy (Windows)
  • Any similar linux tool will work (perf, etc.)

7 of 20

Sample output

8 of 20

9 of 20

Intrusive profilers

  • User defines what’s traced.
  • Accurate data. Nanoseconds not % of samples.
  • Useful to detect spikes of activity.

10 of 20

11 of 20

What is HawkTracer?

  • Intrusive profiler library made by Marcin Kolny.
  • It open-source - MIT licence https://github.com/amzn/hawktracer/
  • Targets low-end platforms (think single core < 1GHZ) so it has minimal overhead.
  • Can stream profiling data over network
  • Outputs available: chrome-tracing, callgrind, flamegraphs generation, more to come (hawktracer-converter)

12 of 20

What is HawkTracer?

Profiling Low-End Platforms using HawkTracer Profiler Marcin Kolny

Track: Free Tools and Editors devroom

Room: UD2.119

Day: Sunday 16:30 - 17:00

13 of 20

rust_hawktracer

  • Rust API for the HawkTracer profiler.

It has the following goals (in order of priority).

  • Low-overhead
  • Easy to use
  • Hard to make mistakes

14 of 20

15 of 20

16 of 20

17 of 20

Profiling data pipeline

Your rust program

rust_hawktracer

hawtracer-converter

Profiling Data (Binary)

Chrome-tracing

(JSON)

Flamegraph

Callgrind format

Other formats on the way

18 of 20

Live coding demo time!

19 of 20

What's next?

  • Lower overhead tracepoints.
  • Stabilize API - Almost done.
  • Better tool support:
  • No need to download an extra executable? (hawktracer-converter).
    • Probably can hide it behind a config flag like (features=”generate-converter”)
  • The new hawktracer-converter is also a Rust project !!!

20 of 20

Thank you

Twitter: @_AlexEne_

Github: https://github.com/AlexEne

Rust_hawktracer: https://crates.io/crates/rust_hawktracer

Twitch: twitch.tv/nomad_pixel

Questions?