StarPU Handbook

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
starpu_profiling.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2010-2013 Université de Bordeaux 1
4 * Copyright (C) 2010, 2011, 2013 Centre National de la Recherche Scientifique
5 *
6 * StarPU is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or (at
9 * your option) any later version.
10 *
11 * StarPU is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 *
15 * See the GNU Lesser General Public License in COPYING.LGPL for more details.
16 */
17
18 #ifndef __STARPU_PROFILING_H__
19 #define __STARPU_PROFILING_H__
20
21 #include <starpu.h>
22 #include <errno.h>
23 #include <time.h>
24
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #endif
29
30 #define STARPU_PROFILING_DISABLE 0
31 #define STARPU_PROFILING_ENABLE 1
32
33 struct starpu_profiling_task_info
34 {
35 struct timespec submit_time;
36
37 struct timespec push_start_time;
38 struct timespec push_end_time;
39 struct timespec pop_start_time;
40 struct timespec pop_end_time;
41
42 struct timespec acquire_data_start_time;
43 struct timespec acquire_data_end_time;
44
45 struct timespec start_time;
46 struct timespec end_time;
47
48 struct timespec release_data_start_time;
49 struct timespec release_data_end_time;
50
51 struct timespec callback_start_time;
52 struct timespec callback_end_time;
53
54 /* TODO add expected length, expected start/end ? */
55 int workerid;
56
57 uint64_t used_cycles;
58 uint64_t stall_cycles;
59 double power_consumed;
60 };
61
62 struct starpu_profiling_worker_info
63 {
64 struct timespec start_time;
65 struct timespec total_time;
66 struct timespec executing_time;
67 struct timespec sleeping_time;
68 int executed_tasks;
69
70 uint64_t used_cycles;
71 uint64_t stall_cycles;
72 double power_consumed;
73 };
74
75 struct starpu_profiling_bus_info
76 {
77 struct timespec start_time;
78 struct timespec total_time;
79 int long long transferred_bytes;
80 int transfer_count;
81 };
82
83 void starpu_profiling_init();
84 void starpu_profiling_set_id(int new_id);
85 int starpu_profiling_status_set(int status);
86 int starpu_profiling_status_get(void);
87
88 #ifdef BUILDING_STARPU
89 #include <common/utils.h>
90 extern int _starpu_profiling;
91 #define starpu_profiling_status_get() ({ \
92 int __ret; \
93 ANNOTATE_HAPPENS_AFTER(&_starpu_profiling); \
94 __ret = _starpu_profiling; \
95 ANNOTATE_HAPPENS_BEFORE(&_starpu_profiling); \
96 __ret; \
97 })
98 #endif
99
100 int starpu_profiling_worker_get_info(int workerid, struct starpu_profiling_worker_info *worker_info);
101
102 int starpu_bus_get_count(void);
103 int starpu_bus_get_id(int src, int dst);
104 int starpu_bus_get_src(int busid);
105 int starpu_bus_get_dst(int busid);
106
107 int starpu_bus_get_profiling_info(int busid, struct starpu_profiling_bus_info *bus_info);
108
109 /* Some helper functions to manipulate profiling API output */
110 /* Reset timespec */
111 static __starpu_inline void starpu_timespec_clear(struct timespec *tsp)
112 {
113 tsp->tv_sec = 0;
114 tsp->tv_nsec = 0;
115 }
116
117 /* Computes result = a + b */
118 static __starpu_inline void starpu_timespec_add(struct timespec *a,
119 struct timespec *b,
120 struct timespec *result)
121 {
122 result->tv_sec = a->tv_sec + b->tv_sec;
123 result->tv_nsec = a->tv_nsec + b->tv_nsec;
124
125 if (result->tv_nsec >= 1000000000)
126 {
127 ++(result)->tv_sec;
128 result->tv_nsec -= 1000000000;
129 }
130 }
131
132 /* Computes res += b */
133 static __starpu_inline void starpu_timespec_accumulate(struct timespec *result,
134 struct timespec *a)
135 {
136 result->tv_sec += a->tv_sec;
137 result->tv_nsec += a->tv_nsec;
138
139 if (result->tv_nsec >= 1000000000)
140 {
141 ++(result)->tv_sec;
142 result->tv_nsec -= 1000000000;
143 }
144 }
145
146 /* Computes result = a - b */
147 static __starpu_inline void starpu_timespec_sub(const struct timespec *a,
148 const struct timespec *b,
149 struct timespec *result)
150 {
151 result->tv_sec = a->tv_sec - b->tv_sec;
152 result->tv_nsec = a->tv_nsec - b->tv_nsec;
153
154 if ((result)->tv_nsec < 0)
155 {
156 --(result)->tv_sec;
157 result->tv_nsec += 1000000000;
158 }
159 }
160
161 #define starpu_timespec_cmp(a, b, CMP) \
162 (((a)->tv_sec == (b)->tv_sec) ? ((a)->tv_nsec CMP (b)->tv_nsec) : ((a)->tv_sec CMP (b)->tv_sec))
163
164 double starpu_timing_timespec_delay_us(struct timespec *start, struct timespec *end);
165 double starpu_timing_timespec_to_us(struct timespec *ts);
166
167 void starpu_profiling_bus_helper_display_summary(void);
168 void starpu_profiling_worker_helper_display_summary(void);
169
170 #ifdef __cplusplus
171 }
172 #endif
173
174 #endif /* __STARPU_PROFILING_H__ */
starpu_profiling_task_info
Definition: starpu_profiling.h:33
starpu_profiling_task_info::acquire_data_start_time
struct timespec acquire_data_start_time
Definition: starpu_profiling.h:42
starpu_profiling_bus_info::total_time
struct timespec total_time
Definition: starpu_profiling.h:78
starpu_profiling_task_info::start_time
struct timespec start_time
Definition: starpu_profiling.h:45
starpu_bus_get_src
int starpu_bus_get_src(int busid)
starpu_profiling_worker_info::start_time
struct timespec start_time
Definition: starpu_profiling.h:64
starpu_profiling_bus_helper_display_summary
void starpu_profiling_bus_helper_display_summary(void)
starpu_bus_get_profiling_info
int starpu_bus_get_profiling_info(int busid, struct starpu_profiling_bus_info *bus_info)
starpu_profiling_worker_info::executed_tasks
int executed_tasks
Definition: starpu_profiling.h:68
starpu_profiling_task_info::acquire_data_end_time
struct timespec acquire_data_end_time
Definition: starpu_profiling.h:43
starpu_profiling_task_info::used_cycles
uint64_t used_cycles
Definition: starpu_profiling.h:57
starpu_profiling_task_info::power_consumed
double power_consumed
Definition: starpu_profiling.h:59
starpu_profiling_task_info::pop_start_time
struct timespec pop_start_time
Definition: starpu_profiling.h:39
starpu_profiling_worker_info::used_cycles
uint64_t used_cycles
Definition: starpu_profiling.h:70
starpu_profiling_worker_info::stall_cycles
uint64_t stall_cycles
Definition: starpu_profiling.h:71
starpu_profiling_bus_info::transfer_count
int transfer_count
Definition: starpu_profiling.h:80
starpu_profiling_task_info::push_start_time
struct timespec push_start_time
Definition: starpu_profiling.h:37
starpu_profiling_task_info::callback_end_time
struct timespec callback_end_time
Definition: starpu_profiling.h:52
starpu_profiling_task_info::release_data_start_time
struct timespec release_data_start_time
Definition: starpu_profiling.h:48
starpu_profiling_worker_info::sleeping_time
struct timespec sleeping_time
Definition: starpu_profiling.h:67
starpu_profiling_worker_info::total_time
struct timespec total_time
Definition: starpu_profiling.h:65
starpu_profiling_worker_info::executing_time
struct timespec executing_time
Definition: starpu_profiling.h:66
starpu_profiling_task_info::submit_time
struct timespec submit_time
Definition: starpu_profiling.h:35
starpu_profiling_worker_info::power_consumed
double power_consumed
Definition: starpu_profiling.h:72
starpu_profiling_bus_info::start_time
struct timespec start_time
Definition: starpu_profiling.h:77
starpu_profiling_init
void starpu_profiling_init()
starpu_bus_get_dst
int starpu_bus_get_dst(int busid)
starpu_profiling_task_info::pop_end_time
struct timespec pop_end_time
Definition: starpu_profiling.h:40
starpu_profiling_worker_helper_display_summary
void starpu_profiling_worker_helper_display_summary(void)
starpu_timing_timespec_to_us
double starpu_timing_timespec_to_us(struct timespec *ts)
starpu_profiling_task_info::callback_start_time
struct timespec callback_start_time
Definition: starpu_profiling.h:51
starpu_timing_timespec_delay_us
double starpu_timing_timespec_delay_us(struct timespec *start, struct timespec *end)
starpu_profiling_task_info::stall_cycles
uint64_t stall_cycles
Definition: starpu_profiling.h:58
starpu_profiling_worker_info
Definition: starpu_profiling.h:62
starpu_profiling_task_info::workerid
int workerid
Definition: starpu_profiling.h:55
starpu_profiling_status_set
int starpu_profiling_status_set(int status)
starpu_profiling_set_id
void starpu_profiling_set_id(int new_id)
starpu_profiling_task_info::push_end_time
struct timespec push_end_time
Definition: starpu_profiling.h:38
starpu_profiling_task_info::release_data_end_time
struct timespec release_data_end_time
Definition: starpu_profiling.h:49
starpu_bus_get_count
int starpu_bus_get_count(void)
starpu_profiling_bus_info
Definition: starpu_profiling.h:75
starpu_profiling_status_get
int starpu_profiling_status_get(void)
starpu_bus_get_id
int starpu_bus_get_id(int src, int dst)
starpu_profiling_worker_get_info
int starpu_profiling_worker_get_info(int workerid, struct starpu_profiling_worker_info *worker_info)
starpu.h
starpu_profiling_task_info::end_time
struct timespec end_time
Definition: starpu_profiling.h:46
starpu_profiling_bus_info::transferred_bytes
int long long transferred_bytes
Definition: starpu_profiling.h:79