summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libspc/spc_profiler.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libspc/spc_profiler.c')
-rw-r--r--lib/rbcodec/codecs/libspc/spc_profiler.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libspc/spc_profiler.c b/lib/rbcodec/codecs/libspc/spc_profiler.c
new file mode 100644
index 0000000000..0ced8b5bd3
--- /dev/null
+++ b/lib/rbcodec/codecs/libspc/spc_profiler.c
@@ -0,0 +1,66 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006-2007 Adam Gashlin (hcs)
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
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/* lovingly ripped off from Game_Music_Emu 0.5.2. http://www.slack.net/~ant/ */
23/* DSP Based on Brad Martin's OpenSPC DSP emulator */
24/* tag reading from sexyspc by John Brawn (John_Brawn@yahoo.com) and others */
25
26#if defined(SPC_PROFILE) && defined(USEC_TIMER)
27
28#include "codeclib.h"
29#include "spc_codec.h"
30#define SPC_DEFINE_PROFILER_TIMERS
31#include "spc_profiler.h"
32
33void reset_profile_timers(void)
34{
35 RESET_TIMER(total);
36 RESET_TIMER(render);
37#if 0
38 RESET_TIMER(cpu);
39 RESET_TIMER(dsp);
40 RESET_TIMER(dsp_pregen);
41 RESET_TIMER(dsp_gen);
42 RESET_TIMER(dsp_mix);
43#endif
44}
45
46void print_timers(char * path)
47{
48 int logfd = ci->open("/spclog.txt",O_WRONLY|O_CREAT|O_APPEND, 0666);
49 ci->fdprintf(logfd,"%s:\t",path);
50 ci->fdprintf(logfd,"%10ld total\t",READ_TIMER(total));
51 PRINT_TIMER_PCT(render,total,"render");
52#if 0
53 PRINT_TIMER_PCT(cpu,total,"CPU");
54 PRINT_TIMER_PCT(dsp,total,"DSP");
55 ci->fdprintf(logfd,"(");
56 PRINT_TIMER_PCT(dsp_pregen,dsp,"pregen");
57 PRINT_TIMER_PCT(dsp_gen,dsp,"gen");
58 PRINT_TIMER_PCT(dsp_mix,dsp,"mix");
59#endif
60 ci->fdprintf(logfd,"\n");
61
62 ci->close(logfd);
63 logfd=-1;
64}
65
66#endif /* #if defined(SPC_PROFILE) && defined(USEC_TIMER) */