Beispiel #1
0
void Extrae_set_options_Wrapper (int options)
{
	Trace_Caller_Enabled[CALLER_MPI] = options & EXTRAE_CALLER_OPTION;
	Trace_HWC_Enabled = options & EXTRAE_HWC_OPTION;
	tracejant_mpi     = options & EXTRAE_MPI_OPTION;   
	tracejant_omp     = options & EXTRAE_OMP_OPTION;   
	Extrae_set_pthread_tracing (options & EXTRAE_PTHREAD_OPTION);
	tracejant_hwc_mpi = options & EXTRAE_MPI_HWC_OPTION;
	tracejant_hwc_omp = options & EXTRAE_OMP_HWC_OPTION;   
	Extrae_set_pthread_hwc_tracing (options & EXTRAE_PTHREAD_HWC_OPTION);
	tracejant_hwc_uf  = options & EXTRAE_UF_HWC_OPTION;
	setSamplingEnabled (options & EXTRAE_SAMPLING_OPTION);
}
int HWCBE_PAPI_Start_Set (UINT64 countglops, UINT64 time, int numset, int threadid)
{
#if defined(PAPI_SAMPLING_SUPPORT)
	int i;
#endif
	int rc;

	/* The given set is a valid one? */
	if (numset < 0 || numset >= HWC_num_sets)
		return FALSE;

	HWC_current_changeat = HWC_sets[numset].change_at;
	HWC_current_changetype = HWC_sets[numset].change_type;
	HWC_current_timebegin[threadid] = time;
	HWC_current_glopsbegin[threadid] = countglops;

	/* Mark this counter set as the current set */
	HWCEVTSET(threadid) = HWC_sets[numset].eventsets[threadid];

#if defined(PAPI_SAMPLING_SUPPORT)
	for (i = 0; i < HWC_sets[numset].NumOverflows; i++)
	{
		if (HWC_sets[numset].OverflowCounter[i] != NO_COUNTER)
		{
			rc = PAPI_overflow (HWCEVTSET(threadid), HWC_sets[numset].OverflowCounter[i],
			  HWC_sets[numset].OverflowValue[i], 0, PAPI_sampling_handler);
			if (rc < 0)
			{
				setSamplingEnabled (FALSE);
				fprintf (stderr, PACKAGE_NAME": PAPI_overflow failed for thread %d - counter %x!\n", threadid, HWC_sets[numset].OverflowCounter[i]);
			}
			else
				setSamplingEnabled (TRUE);
		}
	}
#endif

	rc = PAPI_start (HWCEVTSET(threadid));
 	if (rc == PAPI_OK)
	{
		TRACE_EVENT (time, HWC_CHANGE_EV, numset);

#if defined(PAPI_SAMPLING_SUPPORT)
		if (HWC_sets[numset].NumOverflows > 0)
		{
			long long overflow_values[MAX_HWC];

			HARDWARE_COUNTERS_OVERFLOW(HWC_sets[numset].num_counters, 
			                           HWC_sets[numset].counters, 
			                           HWC_sets[numset].NumOverflows, 
			                           HWC_sets[numset].OverflowCounter,
			                           overflow_values);

			TRACE_EVENT_AND_GIVEN_COUNTERS (time, HWC_SET_OVERFLOW_EV, 0, MAX_HWC, overflow_values);
		}
#endif
	}
	else
	{
		fprintf (stderr, PACKAGE_NAME": PAPI_start failed to start eventset %d on thread %d! (error = %d)\n", numset+1, threadid, rc);
		if (rc == PAPI_ESYS)
		{
			perror ("PAPI_start");
			fprintf (stderr, PACKAGE_NAME": errno = %d\n", errno);
		}
	}

	return rc == PAPI_OK;
}