compare logs before and after single-object profiling

This commit is contained in:
Steffen Jaeckel 2019-10-28 15:23:34 +01:00
parent 04ee1e75d7
commit 02f4ee114c
5 changed files with 79 additions and 6 deletions

View File

@ -1,2 +1,9 @@
all:
gnuplot graphs.dem
sed -e 's@\.log@-$(VERSION)\.log@g' graphs.dem > graphs-$(VERSION).dem
gnuplot graphs-$(VERSION).dem
cmp:
gnuplot before_after.dem
clean:
rm -f *-*.log *.png graphs-*.dem

36
logs/before_after.dem Normal file
View File

@ -0,0 +1,36 @@
set terminal png
set ylabel "Cycles per Operation"
set xlabel "Operand size (bits)"
set output "addsub-ba.png"
plot 'add-before.log' smooth bezier title "Addition (before)", \
'add-after.log' smooth bezier title "Addition (after)", \
'sub-before.log' smooth bezier title "Subtraction (before)", \
'sub-after.log' smooth bezier title "Subtraction (after)"
set output "mult-ba.png"
plot 'mult-before.log' smooth bezier title "Multiplication (without Karatsuba) (before)", \
'mult-after.log' smooth bezier title "Multiplication (without Karatsuba) (after)", \
'mult_kara-before.log' smooth bezier title "Multiplication (Karatsuba) (before)", \
'mult_kara-after.log' smooth bezier title "Multiplication (Karatsuba) (after)"
set output "sqr-ba.png"
plot 'sqr-before.log' smooth bezier title "Squaring (without Karatsuba) (before)", \
'sqr-after.log' smooth bezier title "Squaring (without Karatsuba) (after)", \
'sqr_kara-before.log' smooth bezier title "Squaring (Karatsuba) (before)", \
'sqr_kara-after.log' smooth bezier title "Squaring (Karatsuba) (after)"
set output "expt-ba.png"
plot 'expt-before.log' smooth bezier title "Exptmod (Montgomery) (before)", \
'expt-after.log' smooth bezier title "Exptmod (Montgomery) (after)", \
'expt_dr-before.log' smooth bezier title "Exptmod (Dimminished Radix) (before)", \
'expt_dr-after.log' smooth bezier title "Exptmod (Dimminished Radix) (after)", \
'expt_2k-before.log' smooth bezier title "Exptmod (2k Reduction) (before)", \
'expt_2k-after.log' smooth bezier title "Exptmod (2k Reduction) (after)", \
'expt_2kl-before.log' smooth bezier title "Exptmod (2k-l Reduction) (before)", \
'expt_2kl-after.log' smooth bezier title "Exptmod (2k-l Reduction) (after)"
set output "invmod-ba.png"
plot 'invmod-before.log' smooth bezier title "Modular Inverse (before)", \
'invmod-after.log' smooth bezier title "Modular Inverse (after)"

28
logs/before_after.html Normal file
View File

@ -0,0 +1,28 @@
<html>
<head>
<title>LibTomMath Log Plots</title>
</head>
<body>
<h1>Addition and Subtraction</h1>
<center><img src=addsub-ba.png></center>
<hr>
<h1>Multiplication</h1>
<center><img src=mult-ba.png></center>
<hr>
<h1>Squaring</h1>
<center><img src=sqr-ba.png></center>
<hr>
<h1>Exptmod</h1>
<center><img src=expt-ba.png></center>
<hr>
<h1>Modular Inverse</h1>
<center><img src=invmod-ba.png></center>
<hr>
</body>
</html>

View File

@ -22,6 +22,3 @@
</body>
</html>
/* $Source: /cvs/libtom/libtommath/logs/index.html,v $ */
/* $Revision: 1.2 $ */
/* $Date: 2005/05/05 14:38:47 $ */

View File

@ -72,7 +72,7 @@ profiled:
#make a single object profiled library
profiled_single: pre_gen
$(CC) $(LTM_CFLAGS) -fprofile-arcs -c pre_gen/mp_all.c -o mp_all.o
$(CC) $(LTM_CFLAGS) demo/timing.c mp_all.o -lgcov -o timing
$(CC) $(LTM_CFLAGS) -DMP_VERSION=\"before\" demo/timing.c mp_all.o -lgcov -o timing
./timing
rm -f *.o timing
$(CC) $(LTM_CFLAGS) -fbranch-probabilities -c pre_gen/mp_all.c -o mp_all.o
@ -117,13 +117,18 @@ coveralls: lcov
docs manual:
$(MAKE) -C doc/ $@ V=$(V)
.PHONY: pre_gen
.PHONY: pre_gen cmp
pre_gen:
mkdir -p pre_gen
cat *mp_*.c > mp_all.c
sed -e 's/[[:blank:]]*$$//' mp_all.c > pre_gen/mp_all.c
rm mp_all.c
cmp: profiled_single
$(CC) $(LTM_CFLAGS) -DMP_VERSION=\"after\" demo/timing.c $(LIBNAME) -lgcov -o timing
./timing
$(MAKE) -C logs/ cmp
zipup: clean astyle new_file docs
@# Update the index, so diff-index won't fail in case the pdf has been created.
@# As the pdf creation modifies the tex files, git sometimes detects the