summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-04-20 10:57:07 -0700
committerRandall Spangler <rspangler@chromium.org>2012-04-24 12:54:29 -0700
commit0d19c59aba807f915f1ea46d273bfebe1ded1db9 (patch)
tree7994f84b74ff155c9f73cbef1ec5ad6d146c2da4 /include
parentdbd896103e468e4d5390548e10e148fd7d440048 (diff)
downloadchrome-ec-0d19c59aba807f915f1ea46d273bfebe1ded1db9.tar.gz
Implement task profiling
Also tracks the distribution of IRQs, so we can see what's triggering interrupts. Task profiling is optional, enabled via CONFIG_TASK_PROFILING. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7464 TEST=taskinfo Change-Id: I266f2b49bff9648cda446210d5a302b460fec244
Diffstat (limited to 'include')
-rw-r--r--include/task.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/task.h b/include/task.h
index 5855bdfeb5..79289b1c08 100644
--- a/include/task.h
+++ b/include/task.h
@@ -8,6 +8,7 @@
#ifndef __EC_TASK_H
#define __EC_TASK_H
+#include "board.h"
#include "common.h"
#include "task_id.h"
@@ -69,6 +70,16 @@ uint32_t *task_get_event_bitmap(task_id_t tsk);
* Returns the bitmap of received events (and clears it atomically). */
uint32_t task_wait_event(int timeout_us);
+#ifdef CONFIG_TASK_PROFILING
+/* Start tracking an interrupt.
+ *
+ * This must be called from interrupt context(!) before the interrupt routine
+ * is called. */
+void task_start_irq_handler(void *excep_return);
+#else
+#define task_start_irq_handler(excep_return)
+#endif
+
/* Change the task scheduled after returning from the exception.
*
* If task_send_event() has been called and has set need_resched flag,
@@ -82,7 +93,7 @@ void task_resched_if_needed(void *excep_return);
/* Initializes tasks and interrupt controller. */
int task_pre_init(void);
-/* Starts task scheduling. */
+/* Starts task scheduling. Does not normally return. */
int task_start(void);
/* Enables an interrupt. */
@@ -132,6 +143,7 @@ struct irq_priority {
void IRQ_HANDLER(irq)(void) \
{ \
void *ret = __builtin_return_address(0); \
+ task_start_irq_handler(ret); \
routine(); \
task_resched_if_needed(ret); \
} \