From ae114983db8b75954cdc27c2d97c72c2a9e720f9 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Wed, 26 Aug 2009 21:15:14 -0300 Subject: [PATCH] micro: Plot allocation statistics (time, space and histogram) The allocation statistics are plotted in the same graph where the collections are plotted using the same program run time axe (where possible) to easy comparisons and analysis. --- micro/Makefile | 7 ++- micro/plot-c.gpi | 143 +++++++++++++++++++++++++++++++++-------------- 2 files changed, 105 insertions(+), 45 deletions(-) diff --git a/micro/Makefile b/micro/Makefile index 8529d82..48b7308 100644 --- a/micro/Makefile +++ b/micro/Makefile @@ -82,9 +82,12 @@ plot: $(graphs) $(PLOT_DIR)/%.tics: $(STAT_DIR)/%.h.csv tics.awk $(P_AWK) awk -F, -f $(lastword $^) $< > $@ -$(PLOT_DIR)/%.c.eps: $(STAT_DIR)/%.c.csv plot-c.gpi +$(PLOT_DIR)/%.c.eps: $(STAT_DIR)/%.c.csv $(STAT_DIR)/%.a.csv \ + $(STAT_DIR)/%.h.csv $(PLOT_DIR)/%.tics plot-c.gpi $(P_PLOT) sed "s|@@PRG@@|$(*F)|g; s|@@COL@@|$(VERS)|g; \ - s|@@IN@@|$<|g; s|@@OUT@@|$@|g" $(lastword $^) \ + s|@@INC@@|$(word 1,$^)|g; s|@@INA@@|$(word 2,$^)|g; \ + s|@@INH@@|$(word 3,$^)|g; s|@@OUT@@|$@|g; \ + s|@@TICS@@|$(shell cat $(word 4,$^))|g" $(word 5,$^) \ | $(GNUPLOT) .PHONY: clean diff --git a/micro/plot-c.gpi b/micro/plot-c.gpi index de78abc..ab2a5ea 100644 --- a/micro/plot-c.gpi +++ b/micro/plot-c.gpi @@ -1,48 +1,57 @@ #!/usr/bin/gnuplot # Terminal -set term postscript eps monochrome size 10,7 "Helvetica" 20 +set term postscript eps monochrome size 18cm,27cm 16 set output "@@OUT@@" -# Labels -set multiplot title "Collections for @@PRG@@ (@@COL@@ collector)" +# Title +set multiplot +set label 1 "@@PRG@@ (@@COL@@ collector)" center at screen 0.5,0.987 \ + font "Helvetiva,24" + +# Style Macros +set macros +black = "lc rgb 'black'" +dgray = "lc rgb 'gray40'" +lgray = "lc rgb 'gray70'" +white = "lc rgb 'gray90'" # Tics -set xtics offset 0,graph 1.07 -#set xtics textcolor rgb 'white' +set xtics offset 0,graph 1.05 set mxtics set ytics mirror set mytics set autoscale xfixmax -set grid xtics ytics mxtics +set grid xtics ytics mxtics front lc rgb 'gray20' # Style set style fill solid noborder -# Upper plot (space) +# Data format +set datafile separator ',' + +# Margins set lmargin at screen 0.10 -set rmargin at screen 0.98 -set bmargin at screen 0.40 -set tmargin at screen 0.88 +set rmargin at screen 0.90 + + + +# Collection space plot (1) +############################################################################## +set bmargin at screen 0.62 +set tmargin at screen 0.96 # Reference -set key reverse Left center at screen 0.5,0.92 horizontal +set key reverse Left left top box horizontal # Labels -set ylabel "Space (KiB)" -set label 1 "After collection" at graph 0.02,0.03 left -set label 2 "Before collection" at graph 0.02,0.97 left - -# Macros -set macros -black = "lc rgb 'black'" -dgray = "lc rgb 'gray40'" -lgray = "lc rgb 'gray70'" -white = "lc rgb 'gray90'" +set ylabel "Space (KiB)" offset 1.5,0 +set y2label "Collections" offset 2.5,0 +set label 2 "After Collection" at graph 0.01,0.03 left +set label 3 "Before Collection" at graph 0.01,0.93 left # Plot -set datafile separator ',' -plot '@@IN@@' \ +plot '@@INC@@' \ using 1:(($5+$6+$7+$8)/1024) title 'Overhead' with boxes @black, \ '' using 1:(($5+$6+$7)/1024) title 'Wasted' with boxes @lgray, \ '' using 1:(($5+$6)/1024) title 'Free' with boxes @dgray, \ @@ -50,38 +59,86 @@ plot '@@IN@@' \ '' using 1:((-$9-$10-$11-$12)/1024) notitle with boxes @black, \ '' using 1:((-$9-$10-$11)/1024) notitle with boxes @lgray, \ '' using 1:((-$9-$10)/1024) notitle with boxes @dgray, \ - '' using 1:(-$9/1024) notitle with boxes @white, \ - 0 notitle with lines @black - + '' using 1:(-$9/1024) notitle with boxes @white -# Lower plot 2 (space) -set bmargin at screen 0.10 -set tmargin at screen 0.40 -# Reference -set key reverse Left center bmargin horizontal +# Collection time plot (2) +############################################################################## +set bmargin at screen 0.42 +set tmargin at screen 0.62 # Labels set ylabel "Time (seconds)" -set xlabel "Program run time (seconds)" +set y2label "Collections" unset label 1 unset label 2 +unset label 3 + +# Tics +set xtics format "" + +# Plot +plot '@@INC@@' \ + using 1:2 title 'Malloc' with boxes @black, \ + '' using 1:3 title 'Collect' with boxes @dgray, \ + '' using 1:4 title 'Stop the Word' with boxes @white + + + +# Allocation size/time plot (3) +############################################################################## +set bmargin at screen 0.22 +set tmargin at screen 0.42 + +# Labels +set ylabel "Allocation Size (KiB)" +set y2label "Allocation Time (seconds)" offset -1.5,0 +set xlabel "Program Run Time (seconds)" offset 0,0.4 # Tics unset xtics -set xtics +set xtics format "% g" +set ytics nomirror +set y2tics + +# Plot +plot '@@INA@@' \ + using 1:($3/1024) title 'Size' with points @black, \ + '' using 1:2 title 'Time' with points @dgray axes x1y2 + -# Macros -set macros -black = "lc rgb 'black'" -gray = "lc rgb 'gray40'" -white = "lc rgb 'gray80'" + +# Allocation histogram plot (4) +############################################################################## +set bmargin at screen 0.04 +set tmargin at screen 0.18 + +# Histogram settings +set style data histograms +set style histogram rowstacked +set style fill solid 1.0 border -1 +set boxwidth 0.75 + +# Reference +set key left at graph 0,1.085 + +# Labels +set ylabel "Number of Allocations" offset 1.6,0 +set y2label "Allocation Histogram" offset 2.5,0 +set xlabel "Size (bytes)" offset screen -0.45,screen 0.02 + +# Tics +unset xtics +unset y2tics +unset ymtics +unset y2mtics +set xtics scale 0 rotate by -45 (@@TICS@@) font "Helvetica,13" +set ytics mirror +set grid ytics noxtics back # Plot -set datafile separator ',' -plot '@@IN@@' \ - using 1:2 title 'Malloc' with boxes @black, \ - '' using 1:3 title 'Collect' with boxes @gray, \ - '' using 1:4 title 'Stop the word' with boxes @white +plot '@@INH@@' \ + using 2 title column @dgray, \ + '' using 3 title column @lgray -- 2.43.0