Skip to content

Instantly share code, notes, and snippets.

Perfetto for upstream kernel development

Perfetto is super useful for understanding interactions between the kernel and applications. Outside of Android and ChromeOS, though it's use isn't as common. This doc tries to provide a basic walk through to get started using perfetto for upstream kernel development with classic linux distros, potentially running under qemu.

Install perfetto

Grab the latest linux- tarball: https://github.com/google/perfetto/releases

Often the tests I’m tracing need to run as root, so because of this, I copied the binaries in the tarball to /usr/local/bin/ and chmod +x the binaries to make

@austriancoder
austriancoder / opengl.c
Created March 6, 2020 09:31
wayland openg
// gcc -o test init_window.c -I. -lwayland-client -lwayland-server -lwayland-egl -lEGL -lGL -I/usr/include/vivante -DDEBUG
#include <wayland-client.h>
#include <wayland-server.h>
#include <wayland-client-protocol.h>
#include <wayland-egl.h> // Wayland EGL MUST be included before EGL headers
#include <EGL/egl.h>
#include <EGL/eglplatform.h>
struct _escontext
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.4.0 (root@7e7f6a76c41e) (gcc version 9.2.1 20191130 (Debian 9.2.1-21)) #24 SMP Sun Dec 15 21:30:10 UTC 2019
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: STMicroelectronics STM32MP157C-DK2 Discovery Board
U-Boot SPL 2020.01-rc5 (Dec 19 2019 - 19:44:32 +0000)
Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
RAM: DDR3-1066/888 bin G 1x4Gb 533MHz v1.45
Trying to boot from MMC1
U-Boot 2020.01-rc5 (Dec 19 2019 - 19:44:32 +0000)
CPU: STM32MP157CAC Rev.B
Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
@austriancoder
austriancoder / build.sh
Created December 19, 2019 20:18
u-boot stm32
make stm32mp15_basic_defconfig
make DEVICE_TREE=stm32mp157c-dk2 all
@austriancoder
austriancoder / config.gateway.json
Created July 13, 2019 13:36
USG CloudFlare configuration
{
"service": {
"dns": {
"dynamic": {
"interface": {
"<WAN interface eg eth0>": {
"service": {
"cloudflare": {
"host-name": [
"<insert A record name here eg. usg.example.com>"
@austriancoder
austriancoder / update.sh
Created July 13, 2019 13:27
USG ddclient update
echo "deb http://archive.debian.org/debian/ wheezy main" >> /etc/apt/sources.list; apt-get update; apt-get -y install libdata-validate-ip-perl
cd /tmp
curl -L -O https://raw.githubusercontent.com/ddclient/ddclient/master/ddclient
cp /usr/sbin/ddclient /usr/sbin/ddclient.bkp
cp ddclient /usr/sbin/ddclient
chmod +x /usr/sbin/ddclient
diff --git a/rnndb/state.xml b/rnndb/state.xml
index 032d73d..d40cda2 100644
--- a/rnndb/state.xml
+++ b/rnndb/state.xml
@@ -284,6 +284,7 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
<bitfield high="26" low="24" name="VAR6"/>
<bitfield high="30" low="28" name="VAR7"/>
</reg32>
+ <reg32 offset="0x03824" name="OCCLUSION_QUERY_ADDR" value="0x0
diff --git a/rnndb/state.xml b/rnndb/state.xml
index 032d73d..9c1c39a 100644
--- a/rnndb/state.xml
+++ b/rnndb/state.xml
@@ -284,6 +284,7 @@ xsi:schemaLocation="http://nouveau.freedesktop.org/ rules-ng.xsd">
<bitfield high="26" low="24" name="VAR6"/>
<bitfield high="30" low="28" name="VAR7"/>
</reg32>
+ <reg32 offset="0x03824" name="OC_A"/>
<reg32 offset="0x03828" name="VARYING_COMPONENT_USE" brief="Varying component usage" value="0x00000000" length="2" stride="4">
@austriancoder
austriancoder / heapstat.sh
Created April 24, 2017 10:25
small script to get some heap information of a process
#!/bin/sh
statusname="/proc/$1/status"
smapsname="/proc/$1/smaps"
echo "===================== $(date +'%s %c') ====================="
awk '
$1 == "MemFree:" { free = $2; next }
$1 == "Cached:" { cached = $2; next }