Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 4.85 KB

README.md

File metadata and controls

68 lines (47 loc) · 4.85 KB

sto

ci badge

This repo contains a server, cli and (super basic) UI to store/retrieve profiler data in an efficient manner. There are also a couple of cool DB functions that leverage the properties of the schema.

The main purpose of this repo is to share ideas. I'll link some slides here that explain this more, but TL;DR you can do cool stuff if you represent profiler data in a DAG (which it is) so this does that.

The cli stores/uploads profiler data to postgres, via the server. The cli profiles a provided locally running pid (via libbpf), symbolizes it (via blazesym) and posts it to the server. The interesting part of the server is more/less this. The CLI is all kinda interesting, but also short. There's also a couple of cool DB functions here.

The UI (templated html web page which GET's some json from the server) shows these stored profiles, along with the capacity savings the storage approach used by this repo uses.

The cli and server are buildable via cargo build --release.

Here's a screenshot of the UI:

CleanShot 2023-03-13 at 02 34 05@2x

How to run this all locally and see how this works for your data.

The easiest way is to use something like gentoo or arch to have the latest-and-greatest kernel and everything else running locally. Ignoring the incredibly important detail of kernel version, the dependencies are all in .devcontainer, in either Dockerfile.db or Dockerfile.

(future-ish) quickstart/live demo.

Note -- this does not work yet, codespaces are running an older kernel than this needs, kernel req TBD (I think 5.19 may work but need to confirm).

I will upload data from a gentoo machine to enable this to be a read-only live-demo with real-yet-contrived data until codespaces are running a new-enough kernel to enable profiling via libbpf in them.

  1. Fork it via:

CleanShot 2023-03-23 at 00 34 22@2x

  1. On your fork, open a code-space of it in your browser via:

CleanShot 2023-03-23 at 00 34 08@2x

  1. Build the server and cli by entering the following into the terminal of your code space as the following image shows:
cargo build --release

CleanShot 2023-03-23 at 00 45 29@2x

  1. Start the server via the following command, and open a new terminal via the indicated + button:
./target/release/server

CleanShot 2023-03-23 at 00 53 08@2x

  1. In this new tab, built and run a binary to test via the following command (or just use htop/whatever and get it's pid, etc.):
cd demo && make && ./demo

CleanShot 2023-03-23 at 00 55 30@2x

  1. Copy the numbers printed (the demo binary's PID) and open a new terminal via the + button indicated: CleanShot 2023-03-23 at 00 56 14@2x

  2. In this new terminal, profile the demo binary and send data to the server via the following command, then click the ports button:

./target/release/cli --version one-or-whatever --binary demo-or-whatever --pid 32651

CleanShot 2023-03-23 at 00 59 02@2x

  1. Open the UI via the following button to see the application being profiled: CleanShot 2023-03-23 at 01 47 23@2x

Cool things used here