summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libspc/spc_profiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libspc/spc_profiler.h')
-rw-r--r--lib/rbcodec/codecs/libspc/spc_profiler.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libspc/spc_profiler.h b/lib/rbcodec/codecs/libspc/spc_profiler.h
new file mode 100644
index 0000000000..405ee43ef9
--- /dev/null
+++ b/lib/rbcodec/codecs/libspc/spc_profiler.h
@@ -0,0 +1,72 @@
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/* a fun simple elapsed time profiler */
23#ifndef _SPC_PROFILER_H_
24#define _SPC_PROFILER_H_
25
26#if defined(SPC_PROFILE) && defined(USEC_TIMER)
27
28#ifdef SPC_DEFINE_PROFILER_TIMERS
29#define CREATE_TIMER(name) uint32_t spc_timer_##name##_start,\
30 spc_timer_##name##_total
31#else
32#define CREATE_TIMER(name) extern uint32_t spc_timer_##name##_start,\
33 spc_timer_##name##_total
34#endif
35
36#define ENTER_TIMER(name) spc_timer_##name##_start=USEC_TIMER
37#define EXIT_TIMER(name) spc_timer_##name##_total+=\
38 (USEC_TIMER-spc_timer_##name##_start)
39#define READ_TIMER(name) (spc_timer_##name##_total)
40#define RESET_TIMER(name) spc_timer_##name##_total=0
41
42#define PRINT_TIMER_PCT(bname,tname,nstr) ci->fdprintf( \
43 logfd,"%10ld ",READ_TIMER(bname));\
44 ci->fdprintf(logfd,"(%3d%%) " nstr "\t",\
45 ((uint64_t)READ_TIMER(bname))*100/READ_TIMER(tname))
46
47CREATE_TIMER(total);
48CREATE_TIMER(render);
49#if 0
50CREATE_TIMER(cpu);
51CREATE_TIMER(dsp);
52CREATE_TIMER(dsp_pregen);
53CREATE_TIMER(dsp_gen);
54CREATE_TIMER(dsp_mix);
55#endif
56
57void reset_profile_timers(void);
58void print_timers(char * path);
59
60#else
61
62#define CREATE_TIMER(name)
63#define ENTER_TIMER(name)
64#define EXIT_TIMER(name)
65#define READ_TIMER(name)
66#define RESET_TIMER(name)
67#define print_timers(path)
68#define reset_profile_timers()
69
70#endif
71
72#endif /* _SPC_PROFILER_H_ */