Last active
July 21, 2017 00:58
-
-
Save aclements/6701446d1ef39e42f3337f00a6f94973 to your computer and use it in GitHub Desktop.
Plot gcpacertrace log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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