compare logs before and after single-object profiling
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
diff --git a/logs/Makefile b/logs/Makefile
index c2ebaf7..59987e5 100644
--- a/logs/Makefile
+++ b/logs/Makefile
@@ -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
diff --git a/logs/before_after.dem b/logs/before_after.dem
new file mode 100644
index 0000000..edb59da
--- /dev/null
+++ b/logs/before_after.dem
@@ -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)"
+
diff --git a/logs/before_after.html b/logs/before_after.html
new file mode 100644
index 0000000..bc866f2
--- /dev/null
+++ b/logs/before_after.html
@@ -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>
diff --git a/logs/index.html b/logs/index.html
index 4b68c25..8c1ed9d 100644
--- a/logs/index.html
+++ b/logs/index.html
@@ -22,6 +22,3 @@
</body>
</html>
-/* $Source: /cvs/libtom/libtommath/logs/index.html,v $ */
-/* $Revision: 1.2 $ */
-/* $Date: 2005/05/05 14:38:47 $ */
diff --git a/makefile b/makefile
index 8dd22ef..9a2b361 100644
--- a/makefile
+++ b/makefile
@@ -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