Skip to content

Instantly share code, notes, and snippets.

View aclements's full-sized avatar

Austin Clements aclements

View GitHub Profile
@aclements
aclements / popcnt_test.go
Created March 17, 2017 19:59
Benchmark of different ways to guard the POPCNT instruction
// Requires https://go-review.googlesource.com/c/38320
package popcnt
import (
"math/bits"
"testing"
)
var sink interface{}
@aclements
aclements / btg.py
Created May 24, 2017 22:06
Failed attempt at using GDB unwinders for Go core files
try:
from gdb.unwinder import Unwinder, register_unwinder
except ImportError:
Unwinder = None
if Unwinder is not None:
class FrameID(object):
def __init__(self, sp, pc):
self.sp = sp
self.pc = pc
@aclements
aclements / pacer.py
Last active July 21, 2017 00:58
Plot gcpacertrace log
# Read gcpacertrace log from stdin and plot pacing.
import sys
import subprocess
gp = subprocess.Popen(["gnuplot", "-persist", "-e", """
set xrange [0:2];
set yrange [0:1];
set xlabel "Heap ratio (h)";
set ylabel "GC CPU (u_a)";
@aclements
aclements / trigger-error.go
Created July 18, 2017 20:03
Plot GC pacer trigger error function
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"image/color"
"math"
"os"
@aclements
aclements / madv_free.go
Created October 29, 2018 15:30
Tool for experimenting with MADV_FREE
// You may want to first disable transparent huge pages:
//
// echo never | sudo tee /sys/kernel/mm/transparent_hugepage/enabled
package main
import (
"flag"
"fmt"
"io/ioutil"