Skip to content

Instantly share code, notes, and snippets.

@aclements
Last active July 21, 2017 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aclements/6701446d1ef39e42f3337f00a6f94973 to your computer and use it in GitHub Desktop.
Save aclements/6701446d1ef39e42f3337f00a6f94973 to your computer and use it in GitHub Desktop.
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)";
set cblabel "GC cycle";
set arrow 1 from 1,0 to 1,1 nohead ls 0;
load "viridis.pal";
plot "-" with p palette pt 2 title "actual pacing", 0.25/x title "stable trigger" lc 0 lw 2, 0.25 title "goal" ls 0
"""], stdin=subprocess.PIPE).stdin
# Stable trigger:
# 0 = h_g - h_T - u_a / u_g * (h_a - h_T)
# u_a / u_g * (h_a - h_T) = h_g - h_T
# (h_a - h_T) / (h_g - h_T) = u_g / u_a
# h = u_g / u_a
i = 0
for line in sys.stdin:
if not line.startswith("pacer: H"):
continue
v = {}
for part in line.strip().split()[1:]:
k, val = part.split("=")
v[k] = float(val)
print >> gp, (v["h_a"] - v["h_t"]) / (v["h_g"] - v["h_t"]), v["u_a"], i
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment