diff options
-rw-r--r-- | firmware/export/profile.h | 10 | ||||
-rw-r--r-- | firmware/thread.c | 6 |
2 files changed, 7 insertions, 9 deletions
diff --git a/firmware/export/profile.h b/firmware/export/profile.h index cb751328ae..3736ac7924 100644 --- a/firmware/export/profile.h +++ b/firmware/export/profile.h | |||
@@ -8,7 +8,7 @@ | |||
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Profiling routines counts ticks and calls to each profiled function. | 10 | * Profiling routines counts ticks and calls to each profiled function. |
11 | * | 11 | * |
12 | * Copyright (C) 2005 by Brandon Low | 12 | * Copyright (C) 2005 by Brandon Low |
13 | * | 13 | * |
14 | * All files in this archive are subject to the GNU General Public License. | 14 | * All files in this archive are subject to the GNU General Public License. |
@@ -31,8 +31,8 @@ | |||
31 | #define INDEX_MASK 0x7FF /* lower INDEX_BITS 1 */ | 31 | #define INDEX_MASK 0x7FF /* lower INDEX_BITS 1 */ |
32 | 32 | ||
33 | /* | 33 | /* |
34 | * In the current setup (pfd has 4 longs and 2 shorts) this uses 20k of RAM | 34 | * In the current setup (pfd has 4 longs and 2 shorts) this uses 20k of RAM |
35 | * for profiling, and allows for profiling sections of code with up-to | 35 | * for profiling, and allows for profiling sections of code with up-to |
36 | * 1024 function caller->callee pairs | 36 | * 1024 function caller->callee pairs |
37 | */ | 37 | */ |
38 | #define NUMPFDS 1024 | 38 | #define NUMPFDS 1024 |
@@ -54,8 +54,6 @@ struct pfd_struct { | |||
54 | #define PROF_OFF_THREAD 0x10 | 54 | #define PROF_OFF_THREAD 0x10 |
55 | #define PROF_ON_THREAD 0x0F | 55 | #define PROF_ON_THREAD 0x0F |
56 | 56 | ||
57 | extern int current_thread; | ||
58 | |||
59 | /* Initialize and start profiling */ | 57 | /* Initialize and start profiling */ |
60 | void profstart(int current_thread) | 58 | void profstart(int current_thread) |
61 | NO_PROF_ATTR; | 59 | NO_PROF_ATTR; |
@@ -72,7 +70,7 @@ void profile_thread_stopped(int current_thread) | |||
72 | void profile_thread_started(int current_thread) | 70 | void profile_thread_started(int current_thread) |
73 | NO_PROF_ATTR; | 71 | NO_PROF_ATTR; |
74 | 72 | ||
75 | void profile_func_exit(void *this_fn, void *call_site) | 73 | void profile_func_exit(void *this_fn, void *call_site) |
76 | NO_PROF_ATTR ICODE_ATTR; | 74 | NO_PROF_ATTR ICODE_ATTR; |
77 | void profile_func_enter(void *this_fn, void *call_site) | 75 | void profile_func_enter(void *this_fn, void *call_site) |
78 | NO_PROF_ATTR ICODE_ATTR; | 76 | NO_PROF_ATTR ICODE_ATTR; |
diff --git a/firmware/thread.c b/firmware/thread.c index c194b2694d..8f89d1c71d 100644 --- a/firmware/thread.c +++ b/firmware/thread.c | |||
@@ -94,7 +94,7 @@ static inline void load_context(const void* addr) __attribute__ ((always_inline) | |||
94 | #ifdef RB_PROFILE | 94 | #ifdef RB_PROFILE |
95 | #include <profile.h> | 95 | #include <profile.h> |
96 | void profile_thread(void) { | 96 | void profile_thread(void) { |
97 | profstart(current_thread); | 97 | profstart(current_thread[CURRENT_CORE]); |
98 | } | 98 | } |
99 | #endif | 99 | #endif |
100 | 100 | ||
@@ -265,7 +265,7 @@ static inline void load_context(const void* addr) | |||
265 | void switch_thread(void) | 265 | void switch_thread(void) |
266 | { | 266 | { |
267 | #ifdef RB_PROFILE | 267 | #ifdef RB_PROFILE |
268 | profile_thread_stopped(current_thread); | 268 | profile_thread_stopped(current_thread[CURRENT_CORE]); |
269 | #endif | 269 | #endif |
270 | int current; | 270 | int current; |
271 | unsigned int *stackptr; | 271 | unsigned int *stackptr; |
@@ -313,7 +313,7 @@ void switch_thread(void) | |||
313 | current_thread[CURRENT_CORE] = current; | 313 | current_thread[CURRENT_CORE] = current; |
314 | load_context(&thread_contexts[CURRENT_CORE][current]); | 314 | load_context(&thread_contexts[CURRENT_CORE][current]); |
315 | #ifdef RB_PROFILE | 315 | #ifdef RB_PROFILE |
316 | profile_thread_started(current_thread); | 316 | profile_thread_started(current_thread[CURRENT_CORE]); |
317 | #endif | 317 | #endif |
318 | } | 318 | } |
319 | 319 | ||