Skip to content

Instantly share code, notes, and snippets.

View dalehamel's full-sized avatar

Dale Hamel dalehamel

View GitHub Profile
@dalehamel
dalehamel / Dockerfile
Last active November 27, 2019 20:24
mctop bcc/bpftrace implementations
FROM alpine:3.10 as builder
# ensure SASL's "libplain.so" is installed as per https://github.com/memcached/memcached/wiki/SASLHowto
RUN apk add --no-cache cyrus-sasl-plain wget binutils
ENV MEMCACHED_VERSION 1.5.19
ENV MEMCACHED_SHA1 14e6a02e743838696fcb620edf6a2fd7e60cabec
# Get dtrace dependencies for alpine in a kinda hacky way
RUN mkdir /build && cd /build && wget http://launchpadlibrarian.net/251391227/systemtap-sdt-dev_2.9-2ubuntu2_amd64.deb && \
bpf: Failed to load program: Permission denied
0: (b7) r3 = 0
1: (7b) *(u64 *)(r10 -8) = r3
last_idx 1 first_idx 0
regs=8 stack=0 before 0: (b7) r3 = 0
2: (7b) *(u64 *)(r10 -16) = r3
3: (7b) *(u64 *)(r10 -24) = r3
4: (7b) *(u64 *)(r10 -32) = r3
5: (7b) *(u64 *)(r10 -40) = r3
6: (7b) *(u64 *)(r10 -48) = r3
BEGIN
{
printf("%-20s %10s %10s %10s\n", "MEMCACHED KEY", "CALLS", "OBJSIZE", "REQ/s");
@start = nsecs;
}
// NOTE - this presently omits incr, decr, and delete because they have a
// different signature
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 5.0.0 Kernel Configuration
#
#
# Compiler: gcc (Gentoo 8.2.0-r6 p1.7) 8.2.0
#
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=80200
# First install https://github.com/postmodern/ruby-install
# Patches are below just download them
# After you have installed with ruby-install, you can chruby to use it
ruby-install ruby 2.6.3 -p 0001-RubyVM-InstructionSequence-eval_with.patch -p 0002-Update-iseq.eval-to-accept-optional-binding-Feature-.patch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_libbcc is a Catch v1.4.0 host application.
Run with -? for options
-------------------------------------------------------------------------------
test bpf stack_id table
-------------------------------------------------------------------------------
/home/dale.hamel/workspace/bcc/tests/cc/test_bpf_table.cc:226
...............................................................................
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_libbcc is a Catch v1.4.0 host application.
Run with -? for options
-------------------------------------------------------------------------------
test bpf stack_id table
-------------------------------------------------------------------------------
/home/dale.hamel/workspace/bcc/tests/cc/test_bpf_table.cc:226
...............................................................................
#!/usr/bin/env ruby
require 'ruby-static-tracing'
DEBUG = ENV['DEBUG']
t = StaticTracing::Tracepoint.new('global', 'hello_nsec', Integer, String)
p = StaticTracing::Provider.fetch(t.provider)
p.enable
l = StaticTracing.nsec
Displaying notes found in: .note.ABI-tag
Owner Data size Description
GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag)
OS: Linux, ABI: 2.6.24
Displaying notes found in: .note.gnu.build-id
Owner Data size Description
GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring)
Build ID: 2fda2cc264d59b38763507fa44cf79f94636aed2
@dalehamel
dalehamel / fetch-linux-headers.sh
Last active January 27, 2019 00:02
Fetch containeros linux headers
#!/bin/bash
LSB_FILE="/mnt/root/etc/lsb-release"
OS_RELEASE_FILE="/mnt/root/etc/os-release"
generate_headers()
{
echo "Generating kernel headers"
cd ${SOURCES_DIR}
zcat /proc/config.gz > .config