diff options
author | Sean Bartell <wingedtachikoma@gmail.com> | 2011-06-25 21:32:25 -0400 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2012-04-25 22:13:20 +0200 |
commit | f40bfc9267b13b54e6379dfe7539447662879d24 (patch) | |
tree | 9b20069d5e62809ff434061ad730096836f916f2 /lib/rbcodec/codecs/libspc/spc_profiler.h | |
parent | a0009907de7a0107d49040d8a180f140e2eff299 (diff) | |
download | rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.tar.gz rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.zip |
Add codecs to librbcodec.
Change-Id: Id7f4717d51ed02d67cb9f9cb3c0ada4a81843f97
Reviewed-on: http://gerrit.rockbox.org/137
Reviewed-by: Nils Wallménius <nils@rockbox.org>
Tested-by: Nils Wallménius <nils@rockbox.org>
Diffstat (limited to 'lib/rbcodec/codecs/libspc/spc_profiler.h')
-rw-r--r-- | lib/rbcodec/codecs/libspc/spc_profiler.h | 72 |
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 | |||
47 | CREATE_TIMER(total); | ||
48 | CREATE_TIMER(render); | ||
49 | #if 0 | ||
50 | CREATE_TIMER(cpu); | ||
51 | CREATE_TIMER(dsp); | ||
52 | CREATE_TIMER(dsp_pregen); | ||
53 | CREATE_TIMER(dsp_gen); | ||
54 | CREATE_TIMER(dsp_mix); | ||
55 | #endif | ||
56 | |||
57 | void reset_profile_timers(void); | ||
58 | void 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_ */ | ||