Author(s): Austin Clements, Rick Hudson
Last updated: 2016-10-18
Discussion at https://golang.org/issue/17503.
| // 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" |
| // 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" |
| # 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)"; |
| 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 |
| // Requires https://go-review.googlesource.com/c/38320 | |
| package popcnt | |
| import ( | |
| "math/bits" | |
| "testing" | |
| ) | |
| var sink interface{} |
| import gdb | |
| _Gdead = 6 | |
| class SliceValue: | |
| """Wrapper for slice values.""" | |
| def __init__(self, val): | |
| self.val = val |
| import gdb | |
| import re | |
| import tempfile | |
| import os | |
| import subprocess | |
| import shutil | |
| import struct | |
| NOTE_HDR = struct.Struct("III") | |
| USER_REGS = struct.Struct(27*"Q") |
| # Compute the object graph of a Go heap and find the path from a root | |
| # to a target address. | |
| import gdb | |
| import collections | |
| class SliceValue: | |
| """Wrapper for slice values.""" | |
| def __init__(self, val): |
Author(s): Austin Clements, Rick Hudson
Last updated: 2016-10-18
Discussion at https://golang.org/issue/17503.