diff --git a/build/common.mk b/build/common.mk index 74849b6c..b8ae74a1 100644 --- a/build/common.mk +++ b/build/common.mk @@ -29,6 +29,7 @@ LDSCRIPT := $(TOPDIR)/system/amiga.lds # Don't reload library base for each call CPPFLAGS += -D__CONSTLIBBASEDECL__=const CPPFLAGS += -DCHIPMEM_KB=$(CHIPMEM) -DFASTMEM_KB=$(FASTMEM) -DLOGOUT=$(LOGOUT) +CPPFLAGS += -DPROFILER=$(PROFILER) include $(TOPDIR)/config.mk diff --git a/config.mk b/config.mk index c7efd1c8..ef2f91e2 100644 --- a/config.mk +++ b/config.mk @@ -18,6 +18,12 @@ LOGOUT := 2 # custom environment created by bootstrap code. AMIGAOS := 0 +# 1 => Turn on profiler that reports minimum-average-maximum number of raster +# lines measured between calls to ProfilerStart / ProfilerStop. +# The measurement is reported every 50 frames (i.e. once a second). +# 0 => Disable the profiler. +PROFILER := 1 + # [only when AMIGAOS=1] Amount of chip and fast (or public) memory # (in kilobytes!) passed to our custom memory allocator. # To calculate total memory taken after an executable file diff --git a/include/effect.h b/include/effect.h index 2093a435..baf9f92c 100644 --- a/include/effect.h +++ b/include/effect.h @@ -101,6 +101,7 @@ typedef struct Profile { u_short count; } ProfileT; +#if PROFILER #define PROFILE(NAME) \ static ProfileT *_##NAME##_profile = &(ProfileT){ \ .name = #NAME, \ @@ -113,6 +114,11 @@ typedef struct Profile { #define ProfilerStart(NAME) _ProfilerStart(_##NAME##_profile) #define ProfilerStop(NAME) _ProfilerStop(_##NAME##_profile) +#else +#define PROFILE(NAME) +#define ProfilerStart(NAME) +#define ProfilerStop(NAME) +#endif /* Puts a task into sleep waiting for Vertical Blank interrupt. * Let's background task do its job. */