summaryrefslogtreecommitdiff
path: root/apps/codecs/spc/spc_profiler.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/spc/spc_profiler.c')
-rw-r--r--apps/codecs/spc/spc_profiler.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/apps/codecs/spc/spc_profiler.c b/apps/codecs/spc/spc_profiler.c
new file mode 100644
index 0000000000..60e0ef7f82
--- /dev/null
+++ b/apps/codecs/spc/spc_profiler.c
@@ -0,0 +1,64 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006-2007 Adam Gashlin (hcs)
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20/* lovingly ripped off from Game_Music_Emu 0.5.2. http://www.slack.net/~ant/ */
21/* DSP Based on Brad Martin's OpenSPC DSP emulator */
22/* tag reading from sexyspc by John Brawn (John_Brawn@yahoo.com) and others */
23
24#if defined(SPC_PROFILE) && defined(USEC_TIMER)
25
26#include "codec.h"
27#include "spc_codec.h"
28#define SPC_DEFINE_PROFILER_TIMERS
29#include "spc_profiler.h"
30
31void reset_profile_timers(void)
32{
33 RESET_TIMER(total);
34 RESET_TIMER(render);
35#if 0
36 RESET_TIMER(cpu);
37 RESET_TIMER(dsp);
38 RESET_TIMER(dsp_pregen);
39 RESET_TIMER(dsp_gen);
40 RESET_TIMER(dsp_mix);
41#endif
42}
43
44void print_timers(char * path)
45{
46 int logfd = ci->open("/spclog.txt",O_WRONLY|O_CREAT|O_APPEND);
47 ci->fdprintf(logfd,"%s:\t",path);
48 ci->fdprintf(logfd,"%10ld total\t",READ_TIMER(total));
49 PRINT_TIMER_PCT(render,total,"render");
50#if 0
51 PRINT_TIMER_PCT(cpu,total,"CPU");
52 PRINT_TIMER_PCT(dsp,total,"DSP");
53 ci->fdprintf(logfd,"(");
54 PRINT_TIMER_PCT(dsp_pregen,dsp,"pregen");
55 PRINT_TIMER_PCT(dsp_gen,dsp,"gen");
56 PRINT_TIMER_PCT(dsp_mix,dsp,"mix");
57#endif
58 ci->fdprintf(logfd,"\n");
59
60 ci->close(logfd);
61 logfd=-1;
62}
63
64#endif /* #if defined(SPC_PROFILE) && defined(USEC_TIMER) */