Skip to content

Commit

Permalink
Enable/disable profiler by setting config.mk option.
Browse files Browse the repository at this point in the history
  • Loading branch information
cahirwpz committed Dec 16, 2023
1 parent 7cc110d commit 9f2b150
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions include/effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ typedef struct Profile {
u_short count;
} ProfileT;

#if PROFILER
#define PROFILE(NAME) \
static ProfileT *_##NAME##_profile = &(ProfileT){ \
.name = #NAME, \
Expand All @@ -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. */
Expand Down

0 comments on commit 9f2b150

Please sign in to comment.