summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs.c6
-rw-r--r--apps/codecs.h11
-rw-r--r--apps/codecs/Tremor/Makefile2
-rw-r--r--apps/codecs/dumb/Makefile2
-rw-r--r--apps/codecs/lib/codeclib.c11
-rw-r--r--apps/codecs/lib/codeclib.h6
-rw-r--r--apps/codecs/libFLAC/Makefile2
-rw-r--r--apps/codecs/liba52/Makefile2
-rw-r--r--apps/codecs/libffmpegFLAC/Makefile2
-rw-r--r--apps/codecs/libm4a/Makefile2
-rw-r--r--apps/codecs/libmad/Makefile2
-rw-r--r--apps/codecs/libmusepack/Makefile2
-rw-r--r--apps/codecs/libwavpack/Makefile2
-rw-r--r--apps/plugin.c6
-rw-r--r--apps/plugin.h11
-rw-r--r--apps/plugins/lib/SOURCES3
-rw-r--r--apps/plugins/lib/profile_plugin.c38
-rw-r--r--apps/plugins/lib/profile_plugin.h35
-rw-r--r--apps/plugins/wav2wv.c12
19 files changed, 146 insertions, 11 deletions
diff --git a/apps/codecs.c b/apps/codecs.c
index d8ad7146df..88b2ea4e07 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -218,6 +218,12 @@ struct codec_api ci = {
218 218
219 /* new stuff at the end, sort into place next time 219 /* new stuff at the end, sort into place next time
220 the API gets incompatible */ 220 the API gets incompatible */
221#ifdef RB_PROFILE
222 profile_thread,
223 profstop,
224 profile_func_enter,
225 profile_func_exit,
226#endif
221 227
222}; 228};
223 229
diff --git a/apps/codecs.h b/apps/codecs.h
index 320431f3bf..70799f790e 100644
--- a/apps/codecs.h
+++ b/apps/codecs.h
@@ -43,6 +43,9 @@
43#include "mpeg.h" 43#include "mpeg.h"
44#include "audio.h" 44#include "audio.h"
45#include "mp3_playback.h" 45#include "mp3_playback.h"
46#ifdef RB_PROFILE
47#include "profile.h"
48#endif
46#if (CONFIG_CODEC == SWCODEC) 49#if (CONFIG_CODEC == SWCODEC)
47#include "dsp.h" 50#include "dsp.h"
48#include "pcm_playback.h" 51#include "pcm_playback.h"
@@ -83,7 +86,7 @@
83#define CODEC_MAGIC 0x52434F44 /* RCOD */ 86#define CODEC_MAGIC 0x52434F44 /* RCOD */
84 87
85/* increase this every time the api struct changes */ 88/* increase this every time the api struct changes */
86#define CODEC_API_VERSION 1 89#define CODEC_API_VERSION 2
87 90
88/* update this to latest version if a change to the api struct breaks 91/* update this to latest version if a change to the api struct breaks
89 backwards compatibility (and please take the opportunity to sort in any 92 backwards compatibility (and please take the opportunity to sort in any
@@ -289,6 +292,12 @@ struct codec_api {
289 292
290 /* new stuff at the end, sort into place next time 293 /* new stuff at the end, sort into place next time
291 the API gets incompatible */ 294 the API gets incompatible */
295#ifdef RB_PROFILE
296 void (*profile_thread)(void);
297 void (*profstop)(void);
298 void (*profile_func_enter)(void *this_fn, void *call_site);
299 void (*profile_func_exit)(void *this_fn, void *call_site);
300#endif
292 301
293}; 302};
294 303
diff --git a/apps/codecs/Tremor/Makefile b/apps/codecs/Tremor/Makefile
index 7fd5de852b..cec9797f63 100644
--- a/apps/codecs/Tremor/Makefile
+++ b/apps/codecs/Tremor/Makefile
@@ -16,7 +16,7 @@ endif
16 16
17TREMOROPTS = -O2 17TREMOROPTS = -O2
18CFLAGS = $(GCCOPTS) $(TREMOROPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ 18CFLAGS = $(GCCOPTS) $(TREMOROPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
19 -DMEM=${MEMORYSIZE} 19 -DMEM=${MEMORYSIZE} ${PROFILE_OPTS}
20 20
21# This sets up 'SRC' based on the files mentioned in SOURCES 21# This sets up 'SRC' based on the files mentioned in SOURCES
22include $(TOOLSDIR)/makesrc.inc 22include $(TOOLSDIR)/makesrc.inc
diff --git a/apps/codecs/dumb/Makefile b/apps/codecs/dumb/Makefile
index fa647f3924..d2a045285e 100644
--- a/apps/codecs/dumb/Makefile
+++ b/apps/codecs/dumb/Makefile
@@ -178,7 +178,7 @@ WFLAGS_ALLEGRO := -Wno-missing-declarations
178OFLAGS := -O2 -ffast-math -fomit-frame-pointer 178OFLAGS := -O2 -ffast-math -fomit-frame-pointer
179DBGFLAGS := -DDEBUGMODE=1 -g3 179DBGFLAGS := -DDEBUGMODE=1 -g3
180 180
181CFLAGS_RELEASE := -Iinclude $(WFLAGS) $(OFLAGS) 181CFLAGS_RELEASE := -Iinclude $(WFLAGS) $(OFLAGS) $(PROFILE_OPTS)
182CFLAGS_DEBUG := -Iinclude $(WFLAGS) $(DBGFLAGS) 182CFLAGS_DEBUG := -Iinclude $(WFLAGS) $(DBGFLAGS)
183 183
184LDFLAGS := -s 184LDFLAGS := -s
diff --git a/apps/codecs/lib/codeclib.c b/apps/codecs/lib/codeclib.c
index cad8f53deb..1f070e8eac 100644
--- a/apps/codecs/lib/codeclib.c
+++ b/apps/codecs/lib/codeclib.c
@@ -149,3 +149,14 @@ void qsort(void *base, size_t nmemb, size_t size,
149{ 149{
150 local_rb->qsort(base,nmemb,size,compar); 150 local_rb->qsort(base,nmemb,size,compar);
151} 151}
152
153#ifdef RB_PROFILE
154void __cyg_profile_func_enter(void *this_fn, void *call_site) {
155 (void)call_site;
156 local_rb->profile_func_enter(this_fn, __builtin_return_address(1));
157}
158
159void __cyg_profile_func_exit(void *this_fn, void *call_site) {
160 local_rb->profile_func_exit(this_fn,call_site);
161}
162#endif
diff --git a/apps/codecs/lib/codeclib.h b/apps/codecs/lib/codeclib.h
index e112112756..c2e7869aa4 100644
--- a/apps/codecs/lib/codeclib.h
+++ b/apps/codecs/lib/codeclib.h
@@ -58,3 +58,9 @@ void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, con
58int codec_init(struct codec_api* rb); 58int codec_init(struct codec_api* rb);
59void codec_set_replaygain(struct mp3entry* id3); 59void codec_set_replaygain(struct mp3entry* id3);
60 60
61#ifdef RB_PROFILE
62void __cyg_profile_func_enter(void *this_fn, void *call_site)
63 NO_PROF_ATTR ICODE_ATTR;
64void __cyg_profile_func_exit(void *this_fn, void *call_site)
65 NO_PROF_ATTR ICODE_ATTR;
66#endif
diff --git a/apps/codecs/libFLAC/Makefile b/apps/codecs/libFLAC/Makefile
index 4008479649..d1e78bd229 100644
--- a/apps/codecs/libFLAC/Makefile
+++ b/apps/codecs/libFLAC/Makefile
@@ -27,7 +27,7 @@ ifeq ($(NEWGCC), 1)
27 FLACOPTS += --param large-function-insns=10000 27 FLACOPTS += --param large-function-insns=10000
28endif 28endif
29 29
30CFLAGS = $(GCCOPTS) $(FLACOPTS)\ 30CFLAGS = $(GCCOPTS) $(PROFILE_OPTS) $(FLACOPTS)\
31$(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} 31$(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
32 32
33# This sets up 'SRC' based on the files mentioned in SOURCES 33# This sets up 'SRC' based on the files mentioned in SOURCES
diff --git a/apps/codecs/liba52/Makefile b/apps/codecs/liba52/Makefile
index 8e0501798d..ea3c01c931 100644
--- a/apps/codecs/liba52/Makefile
+++ b/apps/codecs/liba52/Makefile
@@ -16,7 +16,7 @@ endif
16 16
17A52OPTS = -O2 17A52OPTS = -O2
18CFLAGS = $(GCCOPTS) $(A52OPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ 18CFLAGS = $(GCCOPTS) $(A52OPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
19 -DMEM=${MEMORYSIZE} 19 -DMEM=${MEMORYSIZE} $(PROFILE_OPTS)
20 20
21# This sets up 'SRC' based on the files mentioned in SOURCES 21# This sets up 'SRC' based on the files mentioned in SOURCES
22include $(TOOLSDIR)/makesrc.inc 22include $(TOOLSDIR)/makesrc.inc
diff --git a/apps/codecs/libffmpegFLAC/Makefile b/apps/codecs/libffmpegFLAC/Makefile
index 60da5ae7ff..7d9030e648 100644
--- a/apps/codecs/libffmpegFLAC/Makefile
+++ b/apps/codecs/libffmpegFLAC/Makefile
@@ -16,7 +16,7 @@ endif
16 16
17FLACOPTS = -O2 17FLACOPTS = -O2
18CFLAGS = $(GCCOPTS) $(FLACOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ 18CFLAGS = $(GCCOPTS) $(FLACOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
19 -DMEM=${MEMORYSIZE} 19 -DMEM=${MEMORYSIZE} $(PROFILE_OPTS)
20 20
21# This sets up 'SRC' based on the files mentioned in SOURCES 21# This sets up 'SRC' based on the files mentioned in SOURCES
22include $(TOOLSDIR)/makesrc.inc 22include $(TOOLSDIR)/makesrc.inc
diff --git a/apps/codecs/libm4a/Makefile b/apps/codecs/libm4a/Makefile
index 7f870c9407..fcbc10045e 100644
--- a/apps/codecs/libm4a/Makefile
+++ b/apps/codecs/libm4a/Makefile
@@ -16,7 +16,7 @@ endif
16 16
17M4AOPTS = -O3 17M4AOPTS = -O3
18CFLAGS = $(GCCOPTS) $(M4AOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ 18CFLAGS = $(GCCOPTS) $(M4AOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
19 -DMEM=${MEMORYSIZE} 19 -DMEM=${MEMORYSIZE} $(PROFILE_OPTS)
20 20
21# This sets up 'SRC' based on the files mentioned in SOURCES 21# This sets up 'SRC' based on the files mentioned in SOURCES
22include $(TOOLSDIR)/makesrc.inc 22include $(TOOLSDIR)/makesrc.inc
diff --git a/apps/codecs/libmad/Makefile b/apps/codecs/libmad/Makefile
index e2f2643b27..5eaf9f1517 100644
--- a/apps/codecs/libmad/Makefile
+++ b/apps/codecs/libmad/Makefile
@@ -17,7 +17,7 @@ endif
17# NOTE: FPM_ define has been moved to global.h 17# NOTE: FPM_ define has been moved to global.h
18MADOPTS = -DNDEBUG -O2 18MADOPTS = -DNDEBUG -O2
19CFLAGS = $(GCCOPTS) $(MADOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ 19CFLAGS = $(GCCOPTS) $(MADOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
20 -DMEM=${MEMORYSIZE} 20 -DMEM=${MEMORYSIZE} $(PROFILE_OPTS)
21 21
22# This sets up 'SRC' based on the files mentioned in SOURCES 22# This sets up 'SRC' based on the files mentioned in SOURCES
23include $(TOOLSDIR)/makesrc.inc 23include $(TOOLSDIR)/makesrc.inc
diff --git a/apps/codecs/libmusepack/Makefile b/apps/codecs/libmusepack/Makefile
index 8e65915feb..6bfa2f9462 100644
--- a/apps/codecs/libmusepack/Makefile
+++ b/apps/codecs/libmusepack/Makefile
@@ -16,7 +16,7 @@ endif
16 16
17MUSEPACKOPTS = -O2 17MUSEPACKOPTS = -O2
18CFLAGS = $(GCCOPTS) $(MUSEPACKOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ 18CFLAGS = $(GCCOPTS) $(MUSEPACKOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
19 -DMEM=${MEMORYSIZE} 19 -DMEM=${MEMORYSIZE} $(PROFILE_OPTS)
20 20
21# This sets up 'SRC' based on the files mentioned in SOURCES 21# This sets up 'SRC' based on the files mentioned in SOURCES
22include $(TOOLSDIR)/makesrc.inc 22include $(TOOLSDIR)/makesrc.inc
diff --git a/apps/codecs/libwavpack/Makefile b/apps/codecs/libwavpack/Makefile
index 39478799bf..eba67fa7fc 100644
--- a/apps/codecs/libwavpack/Makefile
+++ b/apps/codecs/libwavpack/Makefile
@@ -16,7 +16,7 @@ endif
16 16
17WAVPACKOPTS = -O2 17WAVPACKOPTS = -O2
18CFLAGS = $(GCCOPTS) $(WAVPACKOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ 18CFLAGS = $(GCCOPTS) $(WAVPACKOPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
19 -DMEM=${MEMORYSIZE} 19 -DMEM=${MEMORYSIZE} $(PROFILE_OPTS)
20 20
21# This sets up 'SRC' based on the files mentioned in SOURCES 21# This sets up 'SRC' based on the files mentioned in SOURCES
22include $(TOOLSDIR)/makesrc.inc 22include $(TOOLSDIR)/makesrc.inc
diff --git a/apps/plugin.c b/apps/plugin.c
index 44eb0dc04c..b907604528 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -363,6 +363,12 @@ static const struct plugin_api rockbox_api = {
363 363
364 /* new stuff at the end, sort into place next time 364 /* new stuff at the end, sort into place next time
365 the API gets incompatible */ 365 the API gets incompatible */
366#ifdef RB_PROFILE
367 profile_thread,
368 profstop,
369 profile_func_enter,
370 profile_func_exit,
371#endif
366 372
367}; 373};
368 374
diff --git a/apps/plugin.h b/apps/plugin.h
index 69a2a79ba8..157831bf19 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -44,6 +44,9 @@
44#include "mpeg.h" 44#include "mpeg.h"
45#include "audio.h" 45#include "audio.h"
46#include "mp3_playback.h" 46#include "mp3_playback.h"
47#ifdef RB_PROFILE
48#include "profile.h"
49#endif
47#include "misc.h" 50#include "misc.h"
48#if (HWCODEC == SWCODEC) 51#if (HWCODEC == SWCODEC)
49#include "pcm_playback.h" 52#include "pcm_playback.h"
@@ -93,7 +96,7 @@
93#define PLUGIN_MAGIC 0x526F634B /* RocK */ 96#define PLUGIN_MAGIC 0x526F634B /* RocK */
94 97
95/* increase this every time the api struct changes */ 98/* increase this every time the api struct changes */
96#define PLUGIN_API_VERSION 1 99#define PLUGIN_API_VERSION 2
97 100
98/* update this to latest version if a change to the api struct breaks 101/* update this to latest version if a change to the api struct breaks
99 backwards compatibility (and please take the opportunity to sort in any 102 backwards compatibility (and please take the opportunity to sort in any
@@ -424,6 +427,12 @@ struct plugin_api {
424 427
425 /* new stuff at the end, sort into place next time 428 /* new stuff at the end, sort into place next time
426 the API gets incompatible */ 429 the API gets incompatible */
430#ifdef RB_PROFILE
431 void (*profile_thread)(void);
432 void (*profstop)(void);
433 void (*profile_func_enter)(void *this_fn, void *call_site);
434 void (*profile_func_exit)(void *this_fn, void *call_site);
435#endif
427 436
428}; 437};
429 438
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES
index 4d4247e3bb..0f6e13ebb4 100644
--- a/apps/plugins/lib/SOURCES
+++ b/apps/plugins/lib/SOURCES
@@ -12,3 +12,6 @@ xlcd.c
12#ifdef HAVE_LCD_CHARCELLS 12#ifdef HAVE_LCD_CHARCELLS
13playergfx.c 13playergfx.c
14#endif 14#endif
15#ifdef RB_PROFILE
16profile_plugin.c
17#endif
diff --git a/apps/plugins/lib/profile_plugin.c b/apps/plugins/lib/profile_plugin.c
new file mode 100644
index 0000000000..3318476a89
--- /dev/null
+++ b/apps/plugins/lib/profile_plugin.c
@@ -0,0 +1,38 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Passthrough routines for plugin profiling
11*
12* Copyright (C) 2006 Brandon Low
13*
14* All files in this archive are subject to the GNU General Public License.
15* See the file COPYING in the source tree root for full license agreement.
16*
17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18* KIND, either express or implied.
19*
20****************************************************************************/
21
22#include "plugin.h"
23
24static struct plugin_api *local_rb = NULL; /* global api struct pointer */
25
26void profile_init(struct plugin_api* pa)
27{
28 local_rb = pa;
29}
30
31void __cyg_profile_func_enter(void *this_fn, void *call_site) {
32 (void)call_site;
33 local_rb->profile_func_enter(this_fn, __builtin_return_address(1));
34}
35
36void __cyg_profile_func_exit(void *this_fn, void *call_site) {
37 local_rb->profile_func_exit(this_fn,call_site);
38}
diff --git a/apps/plugins/lib/profile_plugin.h b/apps/plugins/lib/profile_plugin.h
new file mode 100644
index 0000000000..71cff37033
--- /dev/null
+++ b/apps/plugins/lib/profile_plugin.h
@@ -0,0 +1,35 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Passthrough routines for plugin profiling.
11*
12* Copyright (C) 2005 Brandon Low
13*
14* All files in this archive are subject to the GNU General Public License.
15* See the file COPYING in the source tree root for full license agreement.
16*
17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18* KIND, either express or implied.
19*
20****************************************************************************/
21
22#ifndef __PROFILE_PLUGIN_H__
23#define __PROFILE_PLUGIN_H__
24
25#include "plugin.h"
26
27void profile_init(struct plugin_api* pa);
28
29void __cyg_profile_func_enter(void *this_fn, void *call_site)
30 NO_PROF_ATTR ICODE_ATTR;
31void __cyg_profile_func_exit(void *this_fn, void *call_site)
32 NO_PROF_ATTR ICODE_ATTR;
33
34#endif /* __PROFILE_PLUGIN_H__ */
35
diff --git a/apps/plugins/wav2wv.c b/apps/plugins/wav2wv.c
index 20a458960f..812ed176c4 100644
--- a/apps/plugins/wav2wv.c
+++ b/apps/plugins/wav2wv.c
@@ -17,6 +17,9 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "plugin.h" 19#include "plugin.h"
20#ifdef RB_PROFILE
21#include "lib/profile_plugin.h"
22#endif
20 23
21#include <codecs/libwavpack/wavpack.h> 24#include <codecs/libwavpack/wavpack.h>
22 25
@@ -289,6 +292,15 @@ static int wav2wv (char *filename)
289 292
290enum plugin_status plugin_start(struct plugin_api* api, void *parameter) 293enum plugin_status plugin_start(struct plugin_api* api, void *parameter)
291{ 294{
295#ifdef RB_PROFILE
296 /* This doesn't start profiling or anything, it just gives the
297 * profiling functions that are compiled in someplace to call,
298 * this is needed here to let this compile with profiling support
299 * since it calls code from a codec that is compiled with profiling
300 * support */
301 profile_init(api);
302#endif
303
292 rb = api; 304 rb = api;
293 305
294 if (!parameter) 306 if (!parameter)