Skip to content

Commit fbf6f38

Browse files
Write a document covering how to use sysprof.
1 parent 6b97cac commit fbf6f38

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

docs/07-Using-sysprof.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Using sysprof with webkit-container-sdk
2+
3+
This guide explains how to profile applications using `sysprof-cli` from within the webkit-container-sdk container and how to configure passwordless profiling on the host system.
4+
5+
## Overview
6+
7+
`sysprof-cli` is a system profiling tool that captures performance data from running applications. When used from within a container, it communicates with the host's `sysprofd` daemon via D-Bus, which requires authentication through polkit by default.
8+
9+
## Basic Usage
10+
11+
To profile an application with sysprof-cli:
12+
13+
```bash
14+
sysprof-cli -f capture.syscap -- your-application [arguments]
15+
```
16+
17+
For example, to profile MiniBrowser:
18+
```bash
19+
sysprof-cli -f profile.syscap -- run-minibrowser --wpe -- --fullscreen https://example.com
20+
```
21+
22+
## Configuring Passwordless Profiling
23+
24+
By default, sysprof requires authentication each time you start profiling. To avoid this, you can create a polkit rule on the host system.
25+
26+
### Step 1: Create a polkit rule
27+
28+
Create a file with the following content:
29+
30+
```bash
31+
sudo tee /etc/polkit-1/rules.d/99-sysprof-noauth.rules > /dev/null << EOF
32+
// Allow specific user to use sysprof without authentication
33+
polkit.addRule(function(action, subject) {
34+
if (action.id == "org.gnome.sysprof3.profile" &&
35+
subject.user == "$USERNAME") {
36+
return polkit.Result.YES;
37+
}
38+
});
39+
EOF
40+
41+
# Set correct permissions
42+
sudo chmod 644 /etc/polkit-1/rules.d/99-sysprof-noauth.rules
43+
44+
# Restart polkit to apply changes
45+
sudo systemctl restart polkit
46+
```
47+
48+
### Step 2: Verify the configuration
49+
50+
After installing the rule, you should be able to run `sysprof-cli` from within the container without being prompted for authentication.
51+
52+
## Viewing Profile Results
53+
54+
After capturing a profile, you can view it using the sysprof GUI application:
55+
56+
```bash
57+
# From the host system
58+
sysprof capture.syscap
59+
```

0 commit comments

Comments
 (0)