Skip to content

Commit 9f2b150

Browse files
committed
Enable/disable profiler by setting config.mk option.
1 parent 7cc110d commit 9f2b150

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

build/common.mk

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ LDSCRIPT := $(TOPDIR)/system/amiga.lds
2929
# Don't reload library base for each call
3030
CPPFLAGS += -D__CONSTLIBBASEDECL__=const
3131
CPPFLAGS += -DCHIPMEM_KB=$(CHIPMEM) -DFASTMEM_KB=$(FASTMEM) -DLOGOUT=$(LOGOUT)
32+
CPPFLAGS += -DPROFILER=$(PROFILER)
3233

3334
include $(TOPDIR)/config.mk
3435

config.mk

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ LOGOUT := 2
1818
# custom environment created by bootstrap code.
1919
AMIGAOS := 0
2020

21+
# 1 => Turn on profiler that reports minimum-average-maximum number of raster
22+
# lines measured between calls to ProfilerStart / ProfilerStop.
23+
# The measurement is reported every 50 frames (i.e. once a second).
24+
# 0 => Disable the profiler.
25+
PROFILER := 1
26+
2127
# [only when AMIGAOS=1] Amount of chip and fast (or public) memory
2228
# (in kilobytes!) passed to our custom memory allocator.
2329
# To calculate total memory taken after an executable file

include/effect.h

+6
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ typedef struct Profile {
101101
u_short count;
102102
} ProfileT;
103103

104+
#if PROFILER
104105
#define PROFILE(NAME) \
105106
static ProfileT *_##NAME##_profile = &(ProfileT){ \
106107
.name = #NAME, \
@@ -113,6 +114,11 @@ typedef struct Profile {
113114

114115
#define ProfilerStart(NAME) _ProfilerStart(_##NAME##_profile)
115116
#define ProfilerStop(NAME) _ProfilerStop(_##NAME##_profile)
117+
#else
118+
#define PROFILE(NAME)
119+
#define ProfilerStart(NAME)
120+
#define ProfilerStop(NAME)
121+
#endif
116122

117123
/* Puts a task into sleep waiting for Vertical Blank interrupt.
118124
* Let's background task do its job. */

0 commit comments

Comments
 (0)