Exemplo n.º 1
0
starpu_event _starpu_event_create() {
   starpu_event ev;

   ev = malloc(sizeof(struct starpu_event_t));

   ev->user_event = 0;

   ev->ref_count = 0;
   ev->ref_count_priv = 1;
   ev->complete = 0;

   ev->trigger_count = 0;
   ev->trigger_size = 5;
   ev->triggers = malloc(ev->trigger_size * sizeof(starpu_trigger));

   pthread_mutex_init(&ev->mutex, NULL);
   pthread_cond_init(&ev->cond, NULL);
   ev->cond_wait_count = 0;

   /* Profiling */
   if (!starpu_profiling_enabled()) {
      ev->profiling_enabled = 0;
   }
   else {
      ev->profiling_enabled = 1;
		starpu_clock_gettime(&ev->prof_submit_time);
		starpu_timespec_clear(&ev->prof_start_time);
		starpu_timespec_clear(&ev->prof_end_time);
      ev->prof_workerid = -1;
   }

   return ev;
}
Exemplo n.º 2
0
static void _starpu_worker_reset_profiling_info_with_lock(int workerid)
{
	_starpu_clock_gettime(&worker_info[workerid].start_time);

	/* This is computed in a lazy fashion when the application queries
	 * profiling info. */
	starpu_timespec_clear(&worker_info[workerid].total_time);

	starpu_timespec_clear(&worker_info[workerid].executing_time);
	starpu_timespec_clear(&worker_info[workerid].sleeping_time);

	worker_info[workerid].executed_tasks = 0;

	worker_info[workerid].used_cycles = 0;
	worker_info[workerid].stall_cycles = 0;
	worker_info[workerid].power_consumed = 0;

	/* We detect if the worker is already sleeping or doing some
	 * computation */
	enum _starpu_worker_status status = _starpu_worker_get_status(workerid);

	if (status == STATUS_SLEEPING)
	{
		worker_registered_sleeping_start[workerid] = 1;
		_starpu_clock_gettime(&sleeping_start_date[workerid]);
	}
	else
	{
		worker_registered_sleeping_start[workerid] = 0;
	}

	if (status == STATUS_EXECUTING)
	{
		worker_registered_executing_start[workerid] = 1;
		_starpu_clock_gettime(&executing_start_date[workerid]);
	}
	else
	{
		worker_registered_executing_start[workerid] = 0;
	}
}