From 97034edb35e92361daaa24512989d00f6c3fd517 Mon Sep 17 00:00:00 2001
From: Paul Selkirk <paul@psgd.org>
Date: Mon, 26 Nov 2018 17:26:55 -0500
Subject: Add loop unrolling to bring the profilable mem* functions closer to
 newlib, because memset is called a LOT in the course of RSA signing, and we
 need to understand how much time we're actually spending there.

---
 libraries/libprof/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'libraries/libprof/Makefile')

diff --git a/libraries/libprof/Makefile b/libraries/libprof/Makefile
index 4fe5fb4..37b9a23 100644
--- a/libraries/libprof/Makefile
+++ b/libraries/libprof/Makefile
@@ -1,12 +1,16 @@
 LIB = libprof.a
 
-OBJS = gmon.o profil.o profiler.o
+OBJS = gmon.o profil.o profiler.o memfunc.o
 
 # Don't profile the profiling code, because that way lies madness (and recursion).
 CFLAGS := $(subst -pg,,$(CFLAGS))
 
 all: $(LIB)
 
+# But do profile the mem functions
+memfunc.o: memfunc.c
+	$(CC) $(CFLAGS) -pg -c -o $@ $<
+
 %.o : %.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
-- 
cgit v1.2.3


From e99737c12cac1fcc8604ac89a14dac5b2606a42d Mon Sep 17 00:00:00 2001
From: Paul Selkirk <paul@psgd.org>
Date: Sun, 2 Dec 2018 17:19:44 -0500
Subject: Clean up the profiling code to the point where I stand a chance of
 understanding it 6 months from now.

While I'm at it, try to make it a little more efficient (because 50-60% of
time in a typical profiling run is spent in the function-entry counting),
and collapse profil.c into gmon.c.
---
 libraries/libprof/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'libraries/libprof/Makefile')

diff --git a/libraries/libprof/Makefile b/libraries/libprof/Makefile
index 37b9a23..28bedea 100644
--- a/libraries/libprof/Makefile
+++ b/libraries/libprof/Makefile
@@ -1,6 +1,6 @@
 LIB = libprof.a
 
-OBJS = gmon.o profil.o profiler.o memfunc.o
+OBJS = gmon.o profiler.o memfunc.o
 
 # Don't profile the profiling code, because that way lies madness (and recursion).
 CFLAGS := $(subst -pg,,$(CFLAGS))
-- 
cgit v1.2.3