|
@@ -1,6 +1,6 @@
|
|
/* StarPU --- Runtime system for heterogeneous multicore architectures.
|
|
/* StarPU --- Runtime system for heterogeneous multicore architectures.
|
|
*
|
|
*
|
|
- * Copyright (C) 2010-2012 Université de Bordeaux 1
|
|
|
|
|
|
+ * Copyright (C) 2010-2013 Université de Bordeaux 1
|
|
* Copyright (C) 2010, 2011, 2012 Centre National de la Recherche Scientifique
|
|
* Copyright (C) 2010, 2011, 2012 Centre National de la Recherche Scientifique
|
|
*
|
|
*
|
|
* StarPU is free software; you can redistribute it and/or modify
|
|
* StarPU is free software; you can redistribute it and/or modify
|
|
@@ -68,8 +68,10 @@ int _starpu_profiling =
|
|
|
|
|
|
int starpu_profiling_status_set(int status)
|
|
int starpu_profiling_status_set(int status)
|
|
{
|
|
{
|
|
|
|
+ ANNOTATE_HAPPENS_AFTER(&_starpu_profiling);
|
|
int prev_value = _starpu_profiling;
|
|
int prev_value = _starpu_profiling;
|
|
_starpu_profiling = status;
|
|
_starpu_profiling = status;
|
|
|
|
+ ANNOTATE_HAPPENS_BEFORE(&_starpu_profiling);
|
|
|
|
|
|
_STARPU_TRACE_SET_PROFILING(status);
|
|
_STARPU_TRACE_SET_PROFILING(status);
|
|
|
|
|
|
@@ -94,12 +96,6 @@ int starpu_profiling_status_set(int status)
|
|
return prev_value;
|
|
return prev_value;
|
|
}
|
|
}
|
|
|
|
|
|
-#undef starpu_profiling_status_get
|
|
|
|
-int starpu_profiling_status_get(void)
|
|
|
|
-{
|
|
|
|
- return _starpu_profiling;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void _starpu_profiling_init(void)
|
|
void _starpu_profiling_init(void)
|
|
{
|
|
{
|
|
int worker;
|
|
int worker;
|
|
@@ -110,7 +106,11 @@ void _starpu_profiling_init(void)
|
|
_starpu_worker_reset_profiling_info(worker);
|
|
_starpu_worker_reset_profiling_info(worker);
|
|
}
|
|
}
|
|
if ((env = getenv("STARPU_PROFILING")) && atoi(env))
|
|
if ((env = getenv("STARPU_PROFILING")) && atoi(env))
|
|
|
|
+ {
|
|
|
|
+ ANNOTATE_HAPPENS_AFTER(&_starpu_profiling);
|
|
_starpu_profiling = STARPU_PROFILING_ENABLE;
|
|
_starpu_profiling = STARPU_PROFILING_ENABLE;
|
|
|
|
+ ANNOTATE_HAPPENS_BEFORE(&_starpu_profiling);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
void _starpu_profiling_terminate(void)
|
|
void _starpu_profiling_terminate(void)
|
|
@@ -127,7 +127,7 @@ struct starpu_task_profiling_info *_starpu_allocate_profiling_info_if_needed(str
|
|
struct starpu_task_profiling_info *info = NULL;
|
|
struct starpu_task_profiling_info *info = NULL;
|
|
|
|
|
|
/* If we are benchmarking, we need room for the power consumption */
|
|
/* If we are benchmarking, we need room for the power consumption */
|
|
- if (_starpu_profiling || (task->cl && task->cl->power_model && (task->cl->power_model->benchmarking || _starpu_get_calibrate_flag())))
|
|
|
|
|
|
+ if (starpu_profiling_status_get() || (task->cl && task->cl->power_model && (task->cl->power_model->benchmarking || _starpu_get_calibrate_flag())))
|
|
{
|
|
{
|
|
info = (struct starpu_task_profiling_info *) calloc(1, sizeof(struct starpu_task_profiling_info));
|
|
info = (struct starpu_task_profiling_info *) calloc(1, sizeof(struct starpu_task_profiling_info));
|
|
STARPU_ASSERT(info);
|
|
STARPU_ASSERT(info);
|
|
@@ -191,7 +191,7 @@ void _starpu_worker_reset_profiling_info(int workerid)
|
|
|
|
|
|
void _starpu_worker_restart_sleeping(int workerid)
|
|
void _starpu_worker_restart_sleeping(int workerid)
|
|
{
|
|
{
|
|
- if (_starpu_profiling)
|
|
|
|
|
|
+ if (starpu_profiling_status_get())
|
|
{
|
|
{
|
|
struct timespec sleep_start_time;
|
|
struct timespec sleep_start_time;
|
|
_starpu_clock_gettime(&sleep_start_time);
|
|
_starpu_clock_gettime(&sleep_start_time);
|
|
@@ -205,7 +205,7 @@ void _starpu_worker_restart_sleeping(int workerid)
|
|
|
|
|
|
void _starpu_worker_stop_sleeping(int workerid)
|
|
void _starpu_worker_stop_sleeping(int workerid)
|
|
{
|
|
{
|
|
- if (_starpu_profiling)
|
|
|
|
|
|
+ if (starpu_profiling_status_get())
|
|
{
|
|
{
|
|
struct timespec *sleeping_start, sleep_end_time;
|
|
struct timespec *sleeping_start, sleep_end_time;
|
|
|
|
|
|
@@ -240,7 +240,7 @@ void _starpu_worker_stop_sleeping(int workerid)
|
|
|
|
|
|
void _starpu_worker_register_executing_start_date(int workerid, struct timespec *executing_start)
|
|
void _starpu_worker_register_executing_start_date(int workerid, struct timespec *executing_start)
|
|
{
|
|
{
|
|
- if (_starpu_profiling)
|
|
|
|
|
|
+ if (starpu_profiling_status_get())
|
|
{
|
|
{
|
|
_STARPU_PTHREAD_MUTEX_LOCK(&worker_info_mutex[workerid]);
|
|
_STARPU_PTHREAD_MUTEX_LOCK(&worker_info_mutex[workerid]);
|
|
worker_registered_executing_start[workerid] = 1;
|
|
worker_registered_executing_start[workerid] = 1;
|
|
@@ -252,7 +252,7 @@ void _starpu_worker_register_executing_start_date(int workerid, struct timespec
|
|
|
|
|
|
void _starpu_worker_update_profiling_info_executing(int workerid, struct timespec *executing_time, int executed_tasks, uint64_t used_cycles, uint64_t stall_cycles, double power_consumed)
|
|
void _starpu_worker_update_profiling_info_executing(int workerid, struct timespec *executing_time, int executed_tasks, uint64_t used_cycles, uint64_t stall_cycles, double power_consumed)
|
|
{
|
|
{
|
|
- if (_starpu_profiling)
|
|
|
|
|
|
+ if (starpu_profiling_status_get())
|
|
{
|
|
{
|
|
_STARPU_PTHREAD_MUTEX_LOCK(&worker_info_mutex[workerid]);
|
|
_STARPU_PTHREAD_MUTEX_LOCK(&worker_info_mutex[workerid]);
|
|
|
|
|
|
@@ -272,7 +272,7 @@ void _starpu_worker_update_profiling_info_executing(int workerid, struct timespe
|
|
|
|
|
|
int starpu_worker_get_profiling_info(int workerid, struct starpu_worker_profiling_info *info)
|
|
int starpu_worker_get_profiling_info(int workerid, struct starpu_worker_profiling_info *info)
|
|
{
|
|
{
|
|
- if (!_starpu_profiling)
|
|
|
|
|
|
+ if (!starpu_profiling_status_get())
|
|
{
|
|
{
|
|
/* Not thread safe, shouldn't be too much a problem */
|
|
/* Not thread safe, shouldn't be too much a problem */
|
|
info->executed_tasks = worker_info[workerid].executed_tasks;
|
|
info->executed_tasks = worker_info[workerid].executed_tasks;
|
|
@@ -319,7 +319,7 @@ int starpu_worker_get_profiling_info(int workerid, struct starpu_worker_profilin
|
|
/* When did the task reach the scheduler ? */
|
|
/* When did the task reach the scheduler ? */
|
|
void _starpu_profiling_set_task_push_start_time(struct starpu_task *task)
|
|
void _starpu_profiling_set_task_push_start_time(struct starpu_task *task)
|
|
{
|
|
{
|
|
- if (!_starpu_profiling)
|
|
|
|
|
|
+ if (!starpu_profiling_status_get())
|
|
return;
|
|
return;
|
|
|
|
|
|
struct starpu_task_profiling_info *profiling_info;
|
|
struct starpu_task_profiling_info *profiling_info;
|
|
@@ -331,7 +331,7 @@ void _starpu_profiling_set_task_push_start_time(struct starpu_task *task)
|
|
|
|
|
|
void _starpu_profiling_set_task_push_end_time(struct starpu_task *task)
|
|
void _starpu_profiling_set_task_push_end_time(struct starpu_task *task)
|
|
{
|
|
{
|
|
- if (!_starpu_profiling)
|
|
|
|
|
|
+ if (!starpu_profiling_status_get())
|
|
return;
|
|
return;
|
|
|
|
|
|
struct starpu_task_profiling_info *profiling_info;
|
|
struct starpu_task_profiling_info *profiling_info;
|
|
@@ -429,3 +429,13 @@ void _starpu_bus_update_profiling_info(int src_node, int dst_node, size_t size)
|
|
bus_profiling_info[src_node][dst_node].transfer_count++;
|
|
bus_profiling_info[src_node][dst_node].transfer_count++;
|
|
// fprintf(stderr, "PROFILE %d -> %d : %d (cnt %d)\n", src_node, dst_node, size, bus_profiling_info[src_node][dst_node].transfer_count);
|
|
// fprintf(stderr, "PROFILE %d -> %d : %d (cnt %d)\n", src_node, dst_node, size, bus_profiling_info[src_node][dst_node].transfer_count);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+#undef starpu_profiling_status_get
|
|
|
|
+int starpu_profiling_status_get(void)
|
|
|
|
+{
|
|
|
|
+ int ret;
|
|
|
|
+ ANNOTATE_HAPPENS_AFTER(&_starpu_profiling);
|
|
|
|
+ ret = _starpu_profiling;
|
|
|
|
+ ANNOTATE_HAPPENS_BEFORE(&_starpu_profiling);
|
|
|
|
+ return ret;
|
|
|
|
+}
|