Skip to content

Instantly share code, notes, and snippets.

View brendangregg's full-sized avatar

Brendan Gregg brendangregg

View GitHub Profile
@brendangregg
brendangregg / sysbench-analysis.txt
Created April 16, 2022 11:47
sysbench cpu x86 arm analysis
Some rough notes from an analysis of sysbench cpu on x86 vs ARM, which showed it was 2.6x faster on ARM only
because of a faster div instruction, which did not translate to a production win. The benchmark was misleading.
I also talked about this topic in my IntelON 2021 talk.
m6g.4xl
=======
test bgregg-focal-arm-v000 us-east-1 i-0d6f5a0062ee66c4e
(root) ~ # sysbench --max-requests=10000000 --max-time=60 --test=cpu --cpu-max-prime=100000 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --max-requests is deprecated, use --events instead
@brendangregg
brendangregg / dockerpsns.sh
Last active August 23, 2023 10:11
docker ps --namespaces
#!/bin/bash
#
# dockerpsns - proof of concept for a "docker ps --namespaces".
#
# USAGE: ./dockerpsns.sh
#
# This lists containers, their init PIDs, and namespace IDs. If container
# namespaces equal the host namespace, they are colored red (this can be
# disabled by setting color=0 below).
#
@brendangregg
brendangregg / tracecompass.log
Created March 21, 2017 16:12
tracecompass log
!SESSION 2017-03-16 16:34:17.214 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_05
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments: -keyring /Users/bgregg/.eclipse_keyring
Command-line arguments: -os macosx -ws cocoa -arch x86_64 -data @noDefault -keyring /Users/bgregg/.eclipse_keyring
!ENTRY org.eclipse.jface 4 0 2017-03-16 18:22:01.494
!MESSAGE Unhandled event loop exception during blocked modal context.
@brendangregg
brendangregg / tracecompass.log
Created March 21, 2017 16:12
tracecompass log
!SESSION 2017-03-16 16:34:17.214 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_05
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments: -keyring /Users/bgregg/.eclipse_keyring
Command-line arguments: -os macosx -ws cocoa -arch x86_64 -data @noDefault -keyring /Users/bgregg/.eclipse_keyring
!ENTRY org.eclipse.jface 4 0 2017-03-16 18:22:01.494
!MESSAGE Unhandled event loop exception during blocked modal context.
kretprobe:SyS_read
{
@.quantize(retval());
}
.
@brendangregg
brendangregg / funcprofile.txt
Created February 15, 2017 19:41
function profiling
~# cd /sys/kernel/debug/tracing/
/sys/kernel/debug/tracing# echo 'SyS_*' > set_ftrace_filter
/sys/kernel/debug/tracing# echo 'sys_*' >> set_ftrace_filter
/sys/kernel/debug/tracing# echo 1 > function_profile_enabled
/sys/kernel/debug/tracing# cat trace_stat/function*
Function Hit Time Avg s^2
-------- --- ---- --- ---
SyS_epoll_wait 248 84493639 us 340700.1 us 144715854 us
SyS_select 66 55851063 us 846228.2 us 2541716507 us
SyS_nanosleep 7 30001020 us 4285860 us 46343405773 us
@brendangregg
brendangregg / cpuunclaimed.py
Last active February 14, 2019 01:46
cpuunclaimed.py draft
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# cpuunclaimed Sample CPU run queues and calculate unclaimed idle CPU.
# For Linux, uses BCC, eBPF.
#
# This samples the length of the run queues and determine when there are idle
# CPUs, yet queued threads waiting their turn. Report the amount of idle
# (yet unclaimed by waiting threads) CPU as a system-wide percentage.
#
@brendangregg
brendangregg / nodejs_http_server.py
Created October 9, 2016 05:28
nodejs_http_server.py
#!/usr/bin/python
#
# nodejs_http_server Basic example of node.js USDT tracing.
# For Linux, uses BCC, BPF. Embedded C.
#
# USAGE: nodejs_http_server PID
#
# Copyright 2016 Netflix, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
@brendangregg
brendangregg / filelife.py
Created October 4, 2016 23:28
filelife.py update with debug
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# filelife Trace the lifespan of short-lived files.
# For Linux, uses BCC, eBPF. Embedded C.
#
# This traces the creation and deletion of files, providing information
# on who deleted the file, the file age, and the file name. The intent is to
# provide information on short-lived files, for debugging or performance
# analysis.
@brendangregg
brendangregg / biosnoop.py
Created August 22, 2016 18:35
biosnoop with 4.7 fix
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# biosnoop Trace block device I/O and print details including issuing PID.
# For Linux, uses BCC, eBPF.
#
# This uses in-kernel eBPF maps to cache process details (PID and comm) by I/O
# request, as well as a starting timestamp for calculating I/O latency.
#
# Copyright (c) 2015 Brendan Gregg.