Commit a3179edc authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Fix [make timings] and introduce [make plot] to plot the performance data.

parent 510e1d40
Pipeline #116828 passed with stages
in 25 seconds
......@@ -2,3 +2,4 @@
.merlin
_build
timings.csv
states-time.pdf
......@@ -45,22 +45,38 @@ test:
# --timings-to <filename>]. The variable $field indicates which field
# we are interested in.
# On MacOS, we require gsed instead of sed.
SED=$(shell if [[ "$$OSTYPE" == "darwin"* ]] ; then echo gsed ; else echo sed ; fi)
.PHONY: timings
timings: test
@ \
field="Construction of the LR(1) automaton" ; \
@ echo "Collecting data (using $(SED))..."
@ field="Construction of the LR(1) automaton" ; \
( \
echo "name,states,time" && \
cd _build/default/test/static/src && \
for f in *.out.timings ; do \
name=$${f%.out.timings} ; \
states=`sed -n -e "s/^Built an LR(1) automaton with \([0-9]\+\) states./\1/p" $${f%.timings}` ; \
time=`sed -n -e "s/^$$field: \(.*\)/\1/p" $$f` ; \
states=`$(SED) -n -e "s/^Built an LR(1) automaton with \([0-9]\+\) states./\1/p" $${f%.timings}` ; \
time=`$(SED) -n -e "s/^$$field: \(.*\)s/\1/p" $$f` ; \
echo "$$name,$$states,$$time" ; \
done \
) > timings.csv
clean::
@ rm -f timings.csv
# [make plot] uses Rscript to plot the data extracted by [make timings].
.PHONY: plot
plot:
@ echo "Running R..."
@ ./timings.r
clean::
@ rm -f states-time.pdf
# [make speed] runs the speed test in test/dynamic/speed.
.PHONY: speed
......
......@@ -2,18 +2,10 @@
require(ggplot2)
# Our working directory.
pwd <- "."
# Load our data.
mydata <- read.csv(paste(pwd, "timings.csv", sep="/"))
mydata <- read.csv("timings.csv")
# Restrict ourselves to a subset of the data.
mydata <- subset(mydata, time >= 0.25)
# A function which saves a plot to a PDF file.
save <- function(filename) {
ggsave(paste(pwd, filename, sep="/"), width=12, height=8, units="cm")
}
mydata <- subset(mydata, time >= 0.1)
# A function that creates a scatter plot. Data on the X and Y axes
# is determined by the argument [xy]. The scale is logarithmic.
......@@ -27,6 +19,6 @@ plotloglog <- function(xy, lx, ly) {
ylab(ly)
}
# Scatter plots.
plotloglog(aes(x=states, y=time), "# states", "time (seconds)")
save("states-time.pdf")
# Plot.
myplot <- plotloglog(aes(x=states, y=time), "# states", "time (seconds)")
ggsave("states-time.pdf", myplot, width=12, height=8, units="cm")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment