Skip to content

Commit f098091

Browse files
committed
Update README.
1 parent 77d3d6b commit f098091

File tree

1 file changed

+57
-9
lines changed

1 file changed

+57
-9
lines changed

README.md

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,58 @@
22

33
samply is a command line CPU profiler which uses the [Firefox profiler](https://profiler.firefox.com/) as its UI.
44

5-
At the moment it runs on macOS and Linux. Windows support is planned. samply is still under development and far from finished, but works quite well already.
5+
samply works on macOS and Linux. Windows support is planned.
66

7-
Give it a try:
7+
In order to profile the execution of `./my-application`, prepend `samply record` to the command invocation:
88

9+
```sh
10+
samply record ./my-application my-arguments
911
```
10-
% cargo install samply
11-
% samply record ./your-command your-arguments
12+
13+
On Linux, samply uses perf events. You can grant temporary access by running:
14+
15+
```sh
16+
echo '1' | sudo tee /proc/sys/kernel/perf_event_paranoid
17+
```
18+
19+
## Installation
20+
21+
You have the following options to install samply:
22+
23+
### Install prebuilt binaries via shell script
24+
25+
```sh
26+
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mstange/samply/releases/download/samply-v0.12.0/samply-installer.sh | sh
27+
```
28+
29+
### Install prebuilt binaries via powershell script
30+
31+
```sh
32+
powershell -c "irm https://github.com/mstange/samply/releases/download/samply-v0.12.0/samply-installer.ps1 | iex"
1233
```
1334

14-
This spawns `./your-command your-arguments` in a subprocess and records a profile of its execution. When the command finishes, samply opens
35+
### Install from crates.io with cargo
36+
37+
```sh
38+
cargo install --locked samply
39+
```
40+
41+
### Build from source
42+
43+
```sh
44+
git clone https://github.com/mstange/samply
45+
cd samply
46+
cargo build --release
47+
./target/release/samply ...
48+
```
49+
50+
## Description
51+
52+
```sh
53+
samply record ./my-application my-arguments
54+
```
55+
56+
This spawns `./my-application my-arguments` in a subprocess and records a profile of its execution. When the command finishes, samply opens
1557
[profiler.firefox.com](https://profiler.firefox.com/) in your default browser, loads the recorded profile in it, and starts a local webserver which serves symbol information and source code.
1658

1759
Then you can inspect the profile. And you can upload it.
@@ -32,16 +74,22 @@ samply is a sampling profiler and collects stack traces, per thread, at some sam
3274

3375
On Linux, samply needs access to performance events system for unprivileged users. For this, you can either:
3476

35-
- if using Linux 5.8 or later, set the `CAP_PERFMON` capability as effective and permitted for samply (recommended):
77+
- Grant access until reboot:
3678

79+
```sh
80+
echo '1' | sudo tee /proc/sys/kernel/perf_event_paranoid
3781
```
38-
sudo setcap 'cap_perfmon+ep' `which samply`
82+
83+
- Grant access more permanently:
84+
85+
```sh
86+
sudo sysctl kernel.perf_event_paranoid=1
3987
```
4088

41-
- allow use of (almost) all events by changing the `perf_event_paranoid` kernel variable (not recommended):
89+
- If using Linux 5.8 or later, you can try setting the `CAP_PERFMON` capability as effective and permitted for samply, though people have reported mixed results with this approach:
4290

4391
```
44-
sudo sysctl kernel.perf_event_paranoid=-1
92+
sudo setcap 'cap_perfmon+ep' `which samply`
4593
```
4694

4795
If you still get a `mmap failed` error (an `EPERM`), you might also need to increase the `mlock` limit, e.g.:

0 commit comments

Comments
 (0)