Ejemplo n.º 1
0
static int GlobalOP_event (event_t * current_event,
	unsigned long long current_time, unsigned int cpu, unsigned int ptask,
	unsigned int task, unsigned int thread, FileSet_t *fset)
{
	unsigned int EvType, EvValue;
	unsigned int comm_id, send_size, receive_size, is_root;
	UNREFERENCED_PARAMETER(fset);

	EvType  = Get_EvEvent (current_event);
	EvValue = Get_EvValue (current_event);

	/* First global operation found, start matching communications from now on */
	if ((tracingCircularBuffer())                                  && /* Circular buffer is enabled */ 
            (getBehaviourForCircularBuffer() == CIRCULAR_SKIP_MATCHES) && /* The buffer behavior is to skip matches */
            (!MatchComms_Enabled(ptask, task))                         && /* Not matching already */
            (EvValue == EVT_END)                                       && /* End of the collective */
            (Get_EvSize(current_event) == GET_NUM_TASKS(ptask))           /* World collective */
            /* (getTagForCircularBuffer() == Get_EvAux(current_event)) */)
	{
		MatchComms_On(ptask, task);
	}

	Switch_State (Get_State(EvType), (EvValue == EVT_BEGIN), ptask, task, thread);

	trace_paraver_state (cpu, ptask, task, thread, current_time);
	trace_paraver_event (cpu, ptask, task, thread, current_time, EvType, EvValue);

	if (EVT_BEGIN == EvValue)
	{
		comm_id = Get_GlobalOP_CommID (current_event);
		is_root = Get_GlobalOP_isRoot (current_event, task);
		send_size = Get_GlobalOP_SendSize (current_event, is_root);
		receive_size = Get_GlobalOP_RecvSize (current_event, is_root);
		trace_enter_global_op (cpu, ptask, task, thread, current_time, comm_id,
		  send_size, receive_size, is_root?1:0);

		Enable_MPI_Soft_Counter (EvType);
	}

	return 0;
}
static int GlobalOP_Event (event_t * current, unsigned long long current_time,
	unsigned int cpu, unsigned int ptask, unsigned int task, unsigned int thread,
	FileSet_t *fset)
{
	thread_t * thread_info = GET_THREAD_INFO(ptask, task, thread);
	UINT64 valor;
	int tipus;
	double temps;

	UNREFERENCED_PARAMETER(cpu);

	temps = current_time-thread_info->Previous_Event_Time;
	temps /= 1000000000.0f;

	if (EVT_BEGIN == Get_EvValue(current))
	{
		UINT64 bsent = Get_GlobalOP_SendSize(current);
		UINT64 brecv = Get_GlobalOP_RecvSize(current);
		int root_rank = Get_GlobalOP_RootRank(current);
		int thd_rank = Get_GlobalOP_RootThd(current);
		int commid = Get_GlobalOP_CommID(current, task);
		int ID = Get_GlobalOP_ID(Get_EvEvent(current));

		Dimemas_CPU_Burst (fset->output_file, task-1, thread-1, temps);
		Dimemas_Global_OP (fset->output_file, task-1, thread-1, ID, commid, root_rank, thd_rank, bsent, brecv );
	}
	else if (EVT_END == Get_EvValue(current))
	{
#ifdef CPUZERO
		Dimemas_CPU_Burst (fset->output_file, task-1, thread-1, 0);
#endif
	}

	Translate_MPI_MPIT2PRV (Get_EvEvent(current), Get_EvValue(current), &tipus, &valor);
	Dimemas_User_Event (fset->output_file, task-1, thread-1, tipus, valor);
	return 0;
}