Polish multicore code
[IRC.git] / Robust / src / Runtime / bamboo / multicoretaskprofile.h
1 #ifndef BAMBOO_MULTICORE_TASK_PROFILE_H
2 #define BAMBOO_MULTICORE_TASK_PROFILE_H
3 #include "multicore.h"
4
5 #ifdef TASK
6 // data structures for profile mode
7 #ifdef PROFILE
8 #define TASKINFOLENGTH 3000
9
10 typedef struct task_info {
11   char* taskName;
12   unsigned long long startTime;
13   unsigned long long endTime;
14   unsigned long long exitIndex;
15   struct Queue * newObjs;
16 } TaskInfo;
17
18 TaskInfo * taskInfoArray[TASKINFOLENGTH];
19 int taskInfoIndex;
20 bool taskInfoOverflow;
21 volatile int profilestatus[NUMCORESACTIVE]; // records status of each core
22                                             // 1: running tasks
23                                             // 0: stall
24 #ifdef PROFILE_INTERRUPT
25 #define INTERRUPTINFOLENGTH 50
26 typedef struct interrupt_info {
27   unsigned long long startTime;
28   unsigned long long endTime;
29 } InterruptInfo;
30
31 InterruptInfo * interruptInfoArray[INTERRUPTINFOLENGTH];
32 int interruptInfoIndex;
33 bool interruptInfoOverflow;
34 #endif
35
36 INLINE void profileTaskStart(char * taskname);
37 INLINE void profileTaskEnd(void);
38 void outputProfileData();
39 INLINE void inittaskprofiledata();
40
41 #define INIT_TASKPROFILE_DATA() inittaskprofiledata()
42 #define PROFILE_TASK_START(s) profileTaskStart(s)
43 #define PROFILE_TASK_END() profileTaskEnd()
44 #ifdef PROFILE_INTERRUPT
45 INLINE void profileInterruptStart_I(void);
46 INLINE void profileInterruptEnd_I(void);
47
48 #define PROFILE_INTERRUPT_START() profileInterruptStart_I()
49 #define PROFILE_INTERRUPT_END() profileInterruptEnd_I()
50 #else
51 #define PROFILE_INTERRUPT_START() 
52 #define PROFILE_INTERRUPT_END() 
53 #endif
54 #else // PROFILE
55 #define INIT_TASKPROFILE_DATA() 
56 #define PROFILE_TASK_START(s)
57 #define PROFILE_TASK_END()
58 #define PROFILE_INTERRUPT_START() 
59 #define PROFILE_INTERRUPT_END() 
60 #endif // PROFILE
61 #else // TASK
62 #define INIT_TASKPROFILE_DATA() 
63 #define PROFILE_TASK_START(s)
64 #define PROFILE_TASK_END()
65 #define PROFILE_INTERRUPT_START() 
66 #define PROFILE_INTERRUPT_END()
67 #endif // TASK
68 #endif // BAMBOO_MULTICORE_TASK_PROFILE_H