>From 57fff73344771739e7723e28df0c0019058a0268 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Sat, 21 Jan 2012 20:18:01 +0100 Subject: [PATCH 1/2] Add option to enable profiling more easily for specific compilation objects --- README | 9 +++++++++ defaults.make | 2 ++ rules.make | 6 +++++- 3 files changed, 16 insertions(+), 1 deletions(-) diff --git a/README b/README index 8d0d067..2d52945 100644 --- a/README +++ b/README @@ -217,6 +217,15 @@ LLVM version of gcc and with "clang", the LLVM-based C compiler, just set C_COMPILER to "llvm-gcc" or "clang". + PROFILE_OBJECTS= + This variable allows you to profile (parts of) Chicken itself. + Just pass in a whitespace-separated list of objects, without + the .scm-extension. (An "object" here is an individual + .scm-file which gets compiled to a .c-file) + To build with profiling support, run "make spotless" first. + Be warned that this is a highly experimental option and + profiling doesn't work for every component of Chicken. + 2.5. Uninstalling Chicken To remove CHICKEN from your file-system, enter (probably as diff --git a/defaults.make b/defaults.make index 03a014d..474f9cd 100644 --- a/defaults.make +++ b/defaults.make @@ -285,6 +285,8 @@ CHICKEN_PROGRAM_OPTIONS += -no-trace CHICKEN_COMPILER_OPTIONS += -no-trace endif +CHICKEN_PROGRAM_OPTIONS += $(if $(PROFILE_OBJECTS),-profile) + # targets CHICKEN_PROGRAM = $(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX) diff --git a/rules.make b/rules.make index 7ec8613..7fc04e8 100644 --- a/rules.make +++ b/rules.make @@ -494,7 +494,11 @@ endef $(foreach lib, $(SETUP_API_OBJECTS_1),\ $(eval $(call declare-emitted-import-lib-dependency,$(lib)))) -bootstrap-lib = $(CHICKEN) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@ +define profile-flags +$(if $(filter $(basename $(1)),$(PROFILE_OBJECTS)),-profile) +endef + +bootstrap-lib = $(CHICKEN) $(call profile-flags, $@) $< $(CHICKEN_LIBRARY_OPTIONS) -output-file $@ library.c: $(SRCDIR)library.scm $(SRCDIR)banner.scm $(SRCDIR)common-declarations.scm $(bootstrap-lib) -- 1.7.3.4