Skip to content

Instantly share code, notes, and snippets.

View brendangregg's full-sized avatar

Brendan Gregg brendangregg

View GitHub Profile
@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 / 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 / xen-vpmu-filter-testing.markdown
Last active July 23, 2016 00:39
Xen vPMU filter testing

Testing of Xen vPMU filter options.

Three tests are executed on a simple program (noploop, which runs NOP in a loop). The first two show Linux "perf stat" summaries, and the third tests specific counters: the IPC ones, an architectural one, and a few extras. Which of these will work depends on the filter mode.

I'll begin by showing off and on, the current modes, and then the new modes: ipc and arch.

vpmu=off (default)

root@lgud-bgregg:~> xl dmesg | grep vpmu
@brendangregg
brendangregg / memprofiletest.c
Last active July 23, 2016 00:34
memprofiletest.c
/*
* memprofiletest
*
* USAGE: ./memprofiletest size_kb
*
* eg, ./memprofiletest 10240 # make larger than LLC cache for misses
*/
#include <stdio.h>
#include <stdlib.h>
#!/usr/bin/sh
#
# intelcpi - measure CPI and utilization on Intel processors.
#
# USAGE: intelcpi [interval]
# eg,
# intelcpi 0.1 # for 0.1 second intervals
#
# CPI shows how memory intensive CPU workloads are.
#
@brendangregg
brendangregg / perfusdtnode.txt
Created June 24, 2016 20:52
Linux perf USDT Node.js
# perf script | c++filt | more
node 36945 [004] 5233.662132: sdt_node:http__server__request: (da8b0c)
9a8b0c node::DTRACE_HTTP_SERVER_REQUEST(v8::FunctionCallbackInfo<v8::Value> const&)+0xffffffffffc0050c (/mnt/node-v4.4.1/out/Release/node)
452992 v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&))+0xffffffffffc00092 (/mnt/node-v4.4.1/out/Releas
e/node)
47c981 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::(anonymous namespace
)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)1>&)+0xffffffffffc001e1 (/mnt/node-v4.4.1/out/Release/node)
47cdde v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*)+0xffffffffffc0003e (/mnt/node-v4.4.1/out/Release/node)
3da7b98068fb Stub:CEntryStub+0x5b (/tmp/perf-36945.map)
3da7b999a619 LazyCompile:~parserOnIncoming _http_server.js:454+0x2f9 (/tmp/perf-36945.