1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
<!--
SPDX-FileCopyrightText: The WebKit GTK and WPE teams
SPDX-License-Identifier: BSD, LGPL-2.1
-->
<!DOCTYPE html>
<html lang="en">
<head>
<title>WPEWebKit – 2.0: Profiling</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8" />
<meta property="og:type" content="website"/>
<meta property="og:title" content="WPEWebKit: Profiling"/>
<meta property="og:description" content="Reference for WPEWebKit-2.0: Profiling"/>
<meta name="twitter:title" content="WPEWebKit: Profiling"/>
<meta name="twitter:description" content="Reference for WPEWebKit-2.0: Profiling"/>
<meta name="twitter:card" content="summary"/>
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="wpe2-urlmap.js"></script>
<script src="fzy.js"></script>
<script src="search.js"></script>
<script src="main.js"></script>
</head>
<body>
<div id="body-wrapper" tabindex="-1">
<nav class="sidebar devhelp-hidden">
<div class="search section">
<form id="search-form" autocomplete="off">
<input id="search-input" type="text" name="do-not-autocomplete" placeholder="Click, or press 's' to search" autocomplete="off"/>
</form>
</div>
<div class="section namespace">
<h3><a href="index.html">WPEWebKit</a></h3>
<p>API Version: 2.0</p>
<p>Library Version: 2.50.5</p>
</div>
<div class="section generator">
<p>Generated by <a href="https://gitlab.gnome.org/GNOME/gi-docgen">gi-docgen</a> 2023.1</p>
</div>
</nav>
<button id="btn-to-top" class="hidden"><span class="up-arrow"></span></button>
<section id="main" class="content">
<section>
<div class="docblock">
<h1 id="profiling-with-sysprof">Profiling with Sysprof<a class="md-anchor" href="#profiling-with-sysprof" title="Permanent link"></a></h1>
<h2 id="prerequisites">Prerequisites<a class="md-anchor" href="#prerequisites" title="Permanent link"></a></h2>
<p>To work with <a href="https://gitlab.gnome.org/GNOME/sysprof/">Sysprof</a> one needs to install it first:</p>
<ul>
<li>ubuntu:</li>
</ul>
<div class="codehilite"><pre><span></span><code>apt install sysprof
</code></pre></div>
<ul>
<li>fedora</li>
</ul>
<div class="codehilite"><pre><span></span><code>dnf install sysprof
</code></pre></div>
<h2 id="profiling">Profiling<a class="md-anchor" href="#profiling" title="Permanent link"></a></h2>
<p>To start the profiling one must either:</p>
<ul>
<li>start <code>sysprof-cli</code> to get a system-wide capture:</li>
</ul>
<div class="codehilite"><pre><span></span><code>sysprof-cli -f
</code></pre></div>
<ul>
<li>or wrap a command with <code>sysprof-cli</code> to get a capture focused on the execution of a particular process tree created by the given command:</li>
</ul>
<div class="codehilite"><pre><span></span><code>sysprof-cli -f -- MiniBrowser 'http://webkit.org'
</code></pre></div>
<p>For more information, please refer to <code>sysprof-cli --help</code>:</p>
<div class="codehilite"><pre><span></span><code>Usage:
sysprof-cli [OPTION…] [CAPTURE_FILE] [-- COMMAND ARGS]
(...)
</code></pre></div>
<h3 id="profiling-webkit-in-the-sdk">Profiling WebKit in the SDK<a class="md-anchor" href="#profiling-webkit-in-the-sdk" title="Permanent link"></a></h3>
<p>When profiling WebKit in the <a href="https://github.com/Igalia/webkit-container-sdk"><span class="caps">SDK</span></a>, one must use the <code>Tools/Scripts/run-minibrowser</code> script as it contains plumbing that makes <code>sysprof-cli</code> work correctly:</p>
<div class="codehilite"><pre><span></span><code>WPE_BROWSER=minibrowser sysprof-cli -f -- Tools/Scripts/run-minibrowser --wpe --release 'https://igalia.com'
</code></pre></div>
<h2 id="working-with-capture-files">Working with capture files<a class="md-anchor" href="#working-with-capture-files" title="Permanent link"></a></h2>
<p>Once the sysprof capture file (<code>.syscap</code>) is produced using <code>sysprof-cli</code>, it’s possible:</p>
<ul>
<li>to visualize the captured data using the Sysprof <span class="caps">GUI</span></li>
<li>to further transform it into textual format format that can be used for playing around with the data</li>
</ul>
<h3 id="visualizing-captured-data">Visualizing captured data<a class="md-anchor" href="#visualizing-captured-data" title="Permanent link"></a></h3>
<p>To visualize the captured data, the <code>sysprof</code> application needs to be launched and the capture file needs to be loaded. It’s possible to open multiple capture files and have them visualized in separate windows.</p>
<h3 id="transforming-captured-data-into-text">Transforming captured data into text<a class="md-anchor" href="#transforming-captured-data-into-text" title="Permanent link"></a></h3>
<p>Visualizing sysprof captures is very feature rich, but sometimes one needs to process the data using scripts to e.g. perform statistical analysis etc. For that, sysprof capture file needs to be transformed from binary format, the textual format that can be easily parsed and processed further. This can be easily done using <code>sysprof-cat</code>:</p>
<div class="codehilite"><pre><span></span><code>sysprof-cat capture.syscap
sysprof-cat --no-callgraph --no-counters capture.syscap
</code></pre></div>
<p>The output format is “<span class="caps">CSS</span>-inspired” yet it’s very easy to write a custom parser for it.</p>
<h2 id="known-problems">Known problems<a class="md-anchor" href="#known-problems" title="Permanent link"></a></h2>
<h3 id="sysprof-cli-not-starting-in-sdk"><code>sysprof-cli</code> not starting in SDK<a class="md-anchor" href="#sysprof-cli-not-starting-in-sdk" title="Permanent link"></a></h3>
<p>If basic <code>sysprof-cli -f</code> command yields errors such as:</p>
<div class="codehilite"><pre><span></span><code>(...)
Sampler: Failed to record copy of “kallsyms” to capture: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Not authorized to make request
Sampler: Failed to load Perf event stream for CPU 0: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Not authorized to make request
Sampler: Failed to load Perf event stream for CPU 1: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Not authorized to make request
Sampler: Failed to load Perf event stream for CPU 2: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Not authorized to make request
Sampler: Failed to load Perf event stream for CPU 3: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Not authorized to make request
(...)
</code></pre></div>
<p>This means that D-Bus calls to the system bus cannot be authorized. To make sure that’s the case, one can run the command:</p>
<div class="codehilite"><pre><span></span><code>dbus-send --system --print-reply --dest=org.gnome.Sysprof3 /org/gnome/Sysprof3 org.gnome.Sysprof3.Service.ListProcesses
</code></pre></div>
<p>and confirm it outputs:</p>
<div class="codehilite"><pre><span></span><code>Error org.freedesktop.DBus.Error.AccessDenied: Not authorized to make request
</code></pre></div>
<p>This means the host system does not have Polkit agent running that would normally be used to ask the user for their password. In such case one needs to install and run a Polkit agentN.</p>
<p>E.g. on ubuntu, the following should do the job:</p>
<div class="codehilite"><pre><span></span><code>sudo apt install policykit-1-gnome
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
</code></pre></div>
</div>
</section>
</section>
<div id="toc" class="toc">
<nav aria-labelledby="toc-title">
<p id="toc-title">Content</p>
<ul class="toc-list">
<li class="toc-list-item"><a href="#prerequisites"><span class="link-text">Prerequisites</span></a></li>
<li class="toc-list-item"><a href="#profiling"><span class="link-text">Profiling</span></a></li>
<li class="toc-list-item"><a href="#working-with-capture-files"><span class="link-text">Working with capture files</span></a></li>
<li class="toc-list-item"><a href="#known-problems"><span class="link-text">Known problems</span></a></li>
</ul>
</nav>
</div>
<section id="search" class="content hidden"></section>
<footer>
</footer>
</div>
</body>
</html>
|