本文整理汇总了C++中PAPI_stop函数的典型用法代码示例。如果您正苦于以下问题:C++ PAPI_stop函数的具体用法?C++ PAPI_stop怎么用?C++ PAPI_stop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PAPI_stop函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: handle_error
/** @class PAPI_stop_counters
* @brief Stop counting hardware events and reset values to zero.
*
* @par C Interface:
* \#include <papi.h> @n
* int PAPI_stop_counters( long long *values, int array_len );
*
* @param *values
* an array where to put the counter values
* @param array_len
* the number of items in the *values array
*
* @post
* After this function is called, the values are reset to zero.
*
* @retval PAPI_EINVAL
* One or more of the arguments is invalid.
* @retval PAPI_ENOTRUN
* The EventSet is not started yet.
* @retval PAPI_ENOEVST
* The EventSet has not been added yet.
*
* The PAPI_stop_counters() function stops the counters and copies the counts
* into the *values array.
* The counters must have been started by a previous call to PAPI_start_counters().
*
* \code
int Events[2] = { PAPI_TOT_CYC, PAPI_TOT_INS };
long long values[2];
if ( PAPI_start_counters( Events, 2 ) != PAPI_OK )
handle_error(1);
your_slow_code();
if ( PAPI_stop_counters( values, 2 ) != PAPI_OK )
handle_error(1);
* \endcode
*
* @see PAPI_read_counters() PAPI_start_counters() PAPI_set_opt()
*/
int
PAPI_stop_counters( long long *values, int array_len )
{
int retval;
HighLevelInfo *state = NULL;
if ( ( retval = _internal_check_state( &state ) ) != PAPI_OK )
return ( retval );
if ( state->running == 0 )
return ( PAPI_ENOTRUN );
if ( state->running == HL_START ) {
if ( array_len < state->num_evts || values == NULL) {
return ( PAPI_EINVAL );
} else {
retval = PAPI_stop( state->EventSet, values );
}
}
if ( state->running > HL_START ) {
long long tmp_values[3];
retval = PAPI_stop( state->EventSet, tmp_values );
}
if ( retval == PAPI_OK ) {
_internal_cleanup_hl_info( state );
PAPI_cleanup_eventset( state->EventSet );
}
APIDBG( "PAPI_stop_counters returns %d\n", retval );
return retval;
}
开发者ID:bpgriner01,项目名称:pbdPAPI,代码行数:70,代码来源:papi_hl.c
示例2: PAPI_stop_counters
int PAPI_stop_counters(long long * values, int array_len)
{
int retval;
HighLevelInfo *state = NULL;
if ((retval = _internal_check_state(&state)) != PAPI_OK)
return (retval);
if (state->running == 0)
return (PAPI_ENOTRUN);
if (state->running == HL_FLOPS || state->running == HL_FLIPS || state->running == HL_IPC) {
long long tmp_values[2];
retval = PAPI_stop(state->EventSet, tmp_values);
}
else if(state->running != HL_START_COUNTERS || array_len < state->num_evts)
return (PAPI_EINVAL);
else
retval = PAPI_stop(state->EventSet, values);
if (retval==PAPI_OK) {
_internal_cleanup_hl_info(state);
PAPI_cleanup_eventset(state->EventSet);
}
APIDBG("PAPI_stop_counters returns %d\n", retval);
return retval;
}
开发者ID:tcreech,项目名称:papi-4.0.0-64-solaris11.2,代码行数:27,代码来源:papi_hl.c
示例3: esd_metric_free
void esd_metric_free(struct esd_metv* metv)
{
int retval, i;
long_long papi_vals[ELG_METRIC_MAXNUM];
if ( metv == NULL )
return;
/* treat PAPI failures at this point as non-fatal */
/* KF: do everything for all components with counters */
for( i=0; i<ELG_PAPIC_MAX_COMP; i++ ) {
if( metv->NumEvents[i]==0 )
continue;
retval = PAPI_stop(metv->EventSet[i], papi_vals);
if ( retval != PAPI_OK ) {
esd_metric_warning(retval, "PAPI_stop");
} else { /* cleanup/destroy require successful PAPI_stop */
retval = PAPI_cleanup_eventset(metv->EventSet[i]);
if ( retval != PAPI_OK )
esd_metric_warning(retval, "PAPI_cleanup_eventset");
retval = PAPI_destroy_eventset(&metv->EventSet[i]);
if ( retval != PAPI_OK )
esd_metric_warning(retval, "PAPI_destroy_eventset");
free(metv);
elg_cntl_msg("Counters stopped");
}
}
}
开发者ID:linearregression,项目名称:scalasca,代码行数:34,代码来源:esd_metric_papi.c
示例4: GPTL_PAPIfinalize
void GPTL_PAPIfinalize (int maxthreads)
{
int t; /* thread index */
int ret; /* return code */
for (t = 0; t < maxthreads; t++) {
ret = PAPI_stop (EventSet[t], papicounters[t]);
free (papicounters[t]);
ret = PAPI_cleanup_eventset (EventSet[t]);
ret = PAPI_destroy_eventset (&EventSet[t]);
}
free (EventSet);
free (papicounters);
/* Reset initial values */
npapievents = 0;
nevents = 0;
is_multiplexed = false;
narrowprint = true;
persec = true;
enable_multiplexing = false;
verbose = false;
}
开发者ID:ACME-Climate,项目名称:cime,代码行数:25,代码来源:gptl_papi.c
示例5: vt_metric_free
void vt_metric_free(struct vt_metv* metv, uint32_t tid)
{
int retval, i;
long_long papi_vals[VT_METRIC_MAXNUM];
if ( metv == NULL )
return;
/* treat PAPI failures at this point as non-fatal */
VT_SUSPEND_IO_TRACING(tid);
/* foreach used eventset */
for (i=0; i < VT_METRIC_MAXNUM && metv->EventSet[i]!=NULL; i++)
{
retval = PAPI_stop(metv->EventSet[i]->EventId, papi_vals);
if ( retval != PAPI_OK ) {
metric_warning(retval, "PAPI_stop");
} else { /* cleanup/destroy require successful PAPI_stop */
retval = PAPI_cleanup_eventset(metv->EventSet[i]->EventId);
if ( retval != PAPI_OK )
metric_warning(retval, "PAPI_cleanup_eventset");
retval = PAPI_destroy_eventset(&metv->EventSet[i]->EventId);
if ( retval != PAPI_OK )
metric_warning(retval, "PAPI_destroy_eventset");
}
free(metv->EventSet[i]);
}
VT_RESUME_IO_TRACING(tid);
free(metv);
}
开发者ID:315234,项目名称:OpenFOAM-2.2.x-OSX,代码行数:33,代码来源:vt_metric_papi.c
示例6: vt_metric_free
void vt_metric_free(struct vt_metv* metv)
{
int retval;
long_long papi_vals[VT_METRIC_MAXNUM];
if ( metv == NULL )
return;
/* treat PAPI failures at this point as non-fatal */
retval = PAPI_stop(metv->EventSet, papi_vals);
if ( retval != PAPI_OK ) {
vt_metric_warning(retval, "PAPI_stop");
} else { /* cleanup/destroy require successful PAPI_stop */
retval = PAPI_cleanup_eventset(metv->EventSet);
if ( retval != PAPI_OK )
vt_metric_warning(retval, "PAPI_cleanup_eventset");
retval = PAPI_destroy_eventset(&metv->EventSet);
if ( retval != PAPI_OK )
vt_metric_warning(retval, "PAPI_destroy_eventset");
free(metv);
/*vt_cntl_msg("Counters stopped");*/
}
}
开发者ID:rjrpaz,项目名称:MyOpenMPI,代码行数:28,代码来源:vt_metric_papi.c
示例7: UNUSED_ARG
JNIEXPORT jint JNICALL Java_papi_Wrapper_eventSetStop
(JNIEnv *env, jclass UNUSED_ARG(self), jlong eventsetid, jlongArray valuesarr) {
if (valuesarr == NULL) {
return PAPI_EINVAL;
}
int values_count = (*env)->GetArrayLength(env, valuesarr);
if (values_count == 0) {
return PAPI_EINVAL;
}
int eventset = (int) eventsetid;
jlong *valuesj = (*env)->GetLongArrayElements(env, valuesarr, NULL);
long long *values = (long long *) valuesj;
int rc = PAPI_stop(eventset, values);
if (rc == PAPI_OK) {
(*env)->ReleaseLongArrayElements(env, valuesarr, valuesj, JNI_COMMIT);
} else {
(*env)->ReleaseLongArrayElements(env, valuesarr, valuesj, JNI_ABORT);
}
DEBUG_PRINT("returning %d (%s)", rc, PAPI_strerror(rc));
return rc;
}
开发者ID:vhotspur,项目名称:papi-java,代码行数:28,代码来源:eventset.c
示例8: PAPI_stop
Timing::~Timing(){
#ifdef KRIPKE_USE_PAPI
long long tmp[16];
PAPI_stop(papi_set, tmp);
#endif
}
开发者ID:DavidPoliakoff,项目名称:performance-test-suite,代码行数:7,代码来源:Timing.cpp
示例9: _hl_rate_calls
int _hl_rate_calls(float *real_time, float *proc_time, long long * ins, float *rate,
int EVENT, HighLevelInfo * state)
{
long long values[2] = { 0, 0 };
int retval = 0;
int level = 0;
if (EVENT == PAPI_FP_INS)
level = HL_FLIPS;
else if (EVENT == PAPI_TOT_INS)
level = HL_IPC;
else if (EVENT == PAPI_FP_OPS)
level = HL_FLOPS;
if (state->running != 0 && state->running != level)
return (PAPI_EINVAL);
if (state->running == 0) {
if (PAPI_query_event(EVENT) != PAPI_OK)
return (PAPI_ENOEVNT);
if ((retval = PAPI_add_event(state->EventSet, EVENT)) != PAPI_OK) {
_internal_cleanup_hl_info(state);
PAPI_cleanup_eventset(state->EventSet);
return (retval);
}
if (PAPI_query_event(PAPI_TOT_CYC) != PAPI_OK)
return (PAPI_ENOEVNT);
if ((retval = PAPI_add_event(state->EventSet, PAPI_TOT_CYC)) != PAPI_OK) {
_internal_cleanup_hl_info(state);
PAPI_cleanup_eventset(state->EventSet);
return (retval);
}
state->initial_time = PAPI_get_real_usec();
if ((retval = PAPI_start(state->EventSet)) != PAPI_OK)
return (retval);
state->running = level;
} else {
if ((retval = PAPI_stop(state->EventSet, values)) != PAPI_OK)
return (retval);
/* Use Multiplication because it is much faster */
*real_time = (float) ((long long)(PAPI_get_real_usec() - state->initial_time) * .000001);
*proc_time = (float) (values[1]*.000001/((_papi_hwi_system_info.hw_info.mhz==0)?1:_papi_hwi_system_info.hw_info.mhz));
if (*proc_time > 0)
*rate = (float) ((float) values[0]*(EVENT==PAPI_TOT_INS?1:_papi_hwi_system_info.hw_info.mhz)/(values[1]==0?1:values[1]));
state->total_proc_time += *proc_time;
state->total_ins += values[0];
*proc_time = state->total_proc_time;
*ins = (long long)state->total_ins;
if ((retval = PAPI_start(state->EventSet)) != PAPI_OK) {
state->running = 0;
return (retval);
}
}
return PAPI_OK;
}
开发者ID:tcreech,项目名称:papi-4.0.0-64-solaris11.2,代码行数:60,代码来源:papi_hl.c
示例10: polybench_papi_stop_counter
void polybench_papi_stop_counter(int evid)
{
# ifdef _OPENMP
# pragma omp parallel
{
if (omp_get_thread_num () == polybench_papi_counters_threadid)
{
# endif
int retval;
long_long values[1];
values[0] = 0;
if ((retval = PAPI_read (polybench_papi_eventset, &values[0]))
!= PAPI_OK)
test_fail (__FILE__, __LINE__, "PAPI_read", retval);
if ((retval = PAPI_stop (polybench_papi_eventset, NULL)) != PAPI_OK)
test_fail (__FILE__, __LINE__, "PAPI_stop", retval);
polybench_papi_values[evid] = values[0];
if ((retval = PAPI_remove_event
(polybench_papi_eventset,
polybench_papi_eventlist[evid])) != PAPI_OK)
test_fail (__FILE__, __LINE__, "PAPI_remove_event", retval);
# ifdef _OPENMP
}
}
#pragma omp barrier
# endif
}
开发者ID:andrewliberis,项目名称:PolyBench-ACC,代码行数:30,代码来源:polybench.c
示例11: resultline
static void
resultline( int i, int j, int EventSet )
{
float ferror = 0;
long long flpins = 0;
long long papi, theory;
int diff, retval;
const PAPI_hw_info_t *hwinfo = NULL;
retval = PAPI_stop( EventSet, &flpins );
if ( retval != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
i++; /* convert to 1s base */
theory = 2;
while ( j-- )
theory *= i; /* theoretical ops */
papi = flpins << FMA;
diff = ( int ) ( papi - theory );
ferror = ( ( float ) abs( diff ) ) / ( ( float ) theory ) * 100;
printf( "%8d %12lld %12lld %8d %10.4f\n", i, papi, theory, diff, ferror );
#ifndef DONT_FAIL
if ( ( hwinfo = PAPI_get_hardware_info( ) ) == NULL )
test_fail( __FILE__, __LINE__, "PAPI_get_hardware_info", 1 );
if ( hwinfo->vendor != PAPI_VENDOR_AMD && ferror > MAX_ERROR &&
abs( diff ) > MAX_DIFF && i > 20 )
test_fail( __FILE__, __LINE__, "Calibrate: error exceeds 10%",
PAPI_EMISC );
#endif
}
开发者ID:naps62,项目名称:CPD_PAPI,代码行数:34,代码来源:calibrate.c
示例12: measure_event
static void
measure_event( int index, PAPI_option_t * option )
{
int retval;
long long value;
if ( ( retval = PAPI_add_event( EventSet, PAPI_event[index] ) ) != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
if ( index == 0 ) {
/* if ((retval = PAPI_get_opt(PAPI_DATA_ADDRESS, option)) != PAPI_OK)
test_fail(__FILE__, __LINE__, "PAPI_get_opt(PAPI_DATA_ADDRESS)", retval);
*/
printf
( "Requested Start Address: %p; Start Offset: 0x%5x; Actual Start Address: %p\n",
option->addr.start, option->addr.start_off,
option->addr.start - option->addr.start_off );
printf
( "Requested End Address: %p; End Offset: 0x%5x; Actual End Address: %p\n",
option->addr.end, option->addr.end_off,
option->addr.end + option->addr.end_off );
}
PAPI_start( EventSet );
do_malloc_work( NUM );
do_static_work( NUM );
PAPI_stop( EventSet, &value );
printf( "%s: %lld\n", event_name[index], value );
if ( ( retval =
PAPI_remove_event( EventSet, PAPI_event[index] ) ) != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_remove_event", retval );
}
开发者ID:naps62,项目名称:CPD_PAPI,代码行数:34,代码来源:data_range.c
示例13: add_two_nonderived_events
void *Thread(void *arg)
{
int retval, num_tests = 1;
int EventSet1=PAPI_NULL;
int mask1, papi_event;
int num_events1;
long long **values;
long long elapsed_us, elapsed_cyc;
char event_name[PAPI_MAX_STR_LEN];
/* add PAPI_TOT_CYC and one of the events in PAPI_FP_INS, PAPI_FP_OPS or
PAPI_TOT_INS, depends on the availability of the event on the
platform */
EventSet1 = add_two_nonderived_events(&num_events1, &papi_event, hw_info, &mask1);
expected[EventSet1] = *(int *)arg / mythreshold;
myid[EventSet1] = PAPI_thread_id();
values = allocate_test_space(num_tests, num_events1);
elapsed_us = PAPI_get_real_usec();
elapsed_cyc = PAPI_get_real_cyc();
if ((retval = PAPI_overflow(EventSet1, papi_event, mythreshold, 0, handler))
!= PAPI_OK)
test_fail(__FILE__, __LINE__, "PAPI_overflow", retval);
/* start_timer(1); */
if ((retval = PAPI_start(EventSet1)) != PAPI_OK)
test_fail(__FILE__, __LINE__, "PAPI_start", retval);
do_stuff();
if ((retval = PAPI_stop(EventSet1, values[0])) != PAPI_OK)
test_fail(__FILE__, __LINE__, "PAPI_stop", retval);
elapsed_us = PAPI_get_real_usec() - elapsed_us;
elapsed_cyc = PAPI_get_real_cyc() - elapsed_cyc;
if ((retval = PAPI_overflow(EventSet1, papi_event, 0, 0, NULL)) != PAPI_OK)
test_fail(__FILE__, __LINE__, "PAPI_overflow", retval);
remove_test_events(&EventSet1, mask1);
if ((retval = PAPI_event_code_to_name(papi_event, event_name)) != PAPI_OK)
test_fail(__FILE__, __LINE__, "PAPI_event_code_to_name", retval);
if (!TESTS_QUIET) {
printf("Thread 0x%x %s : \t%lld\n", (int) pthread_self(),
event_name, (values[0])[0]);
printf("Thread 0x%x PAPI_TOT_CYC: \t%lld\n", (int) pthread_self(), (values[0])[1]);
printf("Thread 0x%x Real usec : \t%lld\n", (int) pthread_self(), elapsed_us);
printf("Thread 0x%x Real cycles : \t%lld\n", (int) pthread_self(), elapsed_cyc);
}
free_test_space(values, num_tests);
pthread_exit(NULL);
return (NULL);
}
开发者ID:tcreech,项目名称:papi-4.0.0-64-solaris11.2,代码行数:60,代码来源:overflow_pthreads.c
示例14: assert
/**
* \brief Frees the memory used in the plan
* \param [in] plan Points to the memory for free-ing.
* \sa parseFFT2Plan
* \sa makeFFT2Plan
* \sa initFFT2Plan
* \sa execFFT2Plan
* \sa perfFFT2Plan
*/
void *killFFT2Plan(void *plan){
Plan *p;
FFTdata *d;
p = (Plan *)plan;
assert(p);
d = (FFTdata *)p->vptr;
assert(d);
pthread_rwlock_wrlock(&FFTW_Lock);
if(DO_PERF){
#ifdef HAVE_PAPI
TEST_PAPI(PAPI_stop(p->PAPI_EventSet, NULL), PAPI_OK, MyRank, 9999, PRINT_SOME);
#endif //HAVE_PAPI
} //DO_PERF
if(d->in_original){
fftw_free(d->in_original);
}
if(d->out){
fftw_free(d->out);
}
if(d->mid){
fftw_free(d->mid);
}
if(d->forward){
fftw_destroy_plan(d->forward);
}
if(d->backward){
fftw_destroy_plan(d->backward);
}
pthread_rwlock_unlock(&FFTW_Lock);
free(d);
free(p);
return (void *)NULL;
} /* killFFT2Plan */
开发者ID:MattBBaker,项目名称:systemburn,代码行数:44,代码来源:plan_fftw2d.c
示例15: event_stop
void event_stop(int *eventSet, int eventCodeSetSize, long long *PMC, int threadID) {
int i, retval;
retval = PAPI_stop( *eventSet, PMC );
if ( retval != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
}
开发者ID:ManuelSelva,项目名称:orcc,代码行数:9,代码来源:eventLib.c
示例16: PAPI_HW_COUNTER_close
void PAPI_HW_COUNTER_close(int tid){
int retval;
#ifdef MEASURE_TIME
#endif
#ifdef MEASURE_HW_COUNTER
retval = PAPI_stop( thr_vars[tid].EventSet, thr_vars[tid].values);
if (retval != PAPI_OK) {
papi_fail(__FILE__, __LINE__, "PAPI_stop()", retval);
}
retval = PAPI_cleanup_eventset( thr_vars[tid].EventSet );
if (retval != PAPI_OK) {
papi_fail(__FILE__, __LINE__,
"PAPI_cleanup_eventset()",retval);
}
retval = PAPI_destroy_eventset( &(thr_vars[tid].EventSet) );
if (retval != PAPI_OK) {
papi_fail(__FILE__, __LINE__,
"PAPI_destroy_eventset()",retval);
}
#endif
#ifdef MEASURE_ENERGY
retval = PAPI_stop( thr_vars[tid].EnergyEventSet, thr_vars[tid].energy_values);
if (retval != PAPI_OK) {
papi_fail(__FILE__, __LINE__, "PAPI_stop()", retval);
}
retval = PAPI_cleanup_eventset( thr_vars[tid].EnergyEventSet );
if (retval != PAPI_OK) {
papi_fail(__FILE__, __LINE__,
"PAPI_cleanup_eventset()",retval);
}
retval = PAPI_destroy_eventset( &(thr_vars[tid].EnergyEventSet) );
if (retval != PAPI_OK) {
papi_fail(__FILE__, __LINE__,
"PAPI_destroy_eventset()",retval);
}
#endif
}
开发者ID:LaminarIR,项目名称:framework,代码行数:44,代码来源:papi_hw_counter.c
示例17: compute
void compute() {
#if PAPI
int EventCode, retval;
int EventSet = PAPI_NULL;
long long PAPI_Counters[MAX_COUNTERS];
/* Initialize the library */
retval = PAPI_library_init(PAPI_VER_CURRENT);
if (retval != PAPI_VER_CURRENT) {
fprintf(stderr, "PAPI library init error!\n");
exit(1);
}
/* PAPI create event */
if (PAPI_create_eventset(&EventSet) != PAPI_OK) {
fprintf(stderr, "create event set: %s", PAPI_strerror(retval));
}
for (int i = 0; i < NUMCOUNTERS; i++) {
if ( (retval = PAPI_add_named_event(EventSet, events[i])) != PAPI_OK) {
fprintf(stderr, "add named event: %s", PAPI_strerror(retval));
}
}
retval = PAPI_start(EventSet);
#endif
float matice1[rozmer][rozmer];
float matice2[rozmer][rozmer];
float matice3[rozmer][rozmer];
//Main multiply code
int j,k,m;
for(j = 0; j < rozmer; j++)
{
for (k = 0; k < rozmer; k++)
{
float temp = 0;
for (m = 0; m < rozmer; m++)
{
temp = temp + matice1[j][m] * matice2[m][k];
}
matice3[j][k] = temp;
}
}
#if PAPI
retval = PAPI_stop(EventSet, PAPI_Counters);
if (retval != PAPI_OK) exit(1);
for (int j = 0; j < NUMCOUNTERS; j++) {
printf("%20lld %s\n", PAPI_Counters[j], events[j]);
// fprintf(stderr, "%lld\n ", PAPI_Counters[j]);
}
#endif
}
开发者ID:goyalankit,项目名称:benchmark-tools,代码行数:56,代码来源:test2.c
示例18: Thread
void
Thread( int t, int n )
{
int retval, num_tests = 1;
int EventSet1 = PAPI_NULL;
int PAPI_event, mask1;
int num_events1;
long long **values;
long long elapsed_us, elapsed_cyc;
char event_name[PAPI_MAX_STR_LEN];
/* add PAPI_TOT_CYC and one of the events in PAPI_FP_INS, PAPI_FP_OPS or
PAPI_TOT_INS, depending on the availability of the event on the
platform */
EventSet1 = add_two_events( &num_events1, &PAPI_event, &mask1 );
retval = PAPI_event_code_to_name( PAPI_event, event_name );
if ( retval != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval );
values = allocate_test_space( num_tests, num_events1 );
retval = PAPI_start( EventSet1 );
if ( retval != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_start", retval );
elapsed_us = PAPI_get_real_usec( );
elapsed_cyc = PAPI_get_real_cyc( );
do_flops( n );
elapsed_us = PAPI_get_real_usec( ) - elapsed_us;
elapsed_cyc = PAPI_get_real_cyc( ) - elapsed_cyc;
retval = PAPI_stop( EventSet1, values[0] );
if ( retval != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
remove_test_events( &EventSet1, mask1 );
if ( !TESTS_QUIET ) {
printf( "Thread %#x %-12s : \t%lld\n", t, event_name,
values[0][1] );
printf( "Thread %#x PAPI_TOT_CYC : \t%lld\n", t,
values[0][0] );
}
free_test_space( values, num_tests );
if ( !TESTS_QUIET ) {
printf( "Thread %#x Real usec : \t%lld\n", t, elapsed_us );
printf( "Thread %#x Real cycles : \t%lld\n", t, elapsed_cyc );
}
PAPI_unregister_thread( );
}
开发者ID:DanieleDeSensi,项目名称:mammut,代码行数:56,代码来源:zero_smp.c
示例19: papi_stop
long long papi_stop(){
if (papi_supported) {
if ((papi_err = PAPI_stop(eventSet, &value)) != PAPI_OK) {
return -1;
}
return value;
}
return -1;
}
开发者ID:gronostajo,项目名称:oora_lab6,代码行数:10,代码来源:papi.c
示例20: main
int
main( int argc, char **argv )
{
double c, a = 0.999, b = 1.001;
int n = 1000;
int EventSet = PAPI_NULL;
int retval;
int i, j = 0;
long long g1[2];
tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
if ( ( retval =
PAPI_library_init( PAPI_VER_CURRENT ) ) != PAPI_VER_CURRENT )
test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
if ( ( retval = PAPI_create_eventset( &EventSet ) ) != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
if ( PAPI_query_event( PAPI_L2_TCM ) == PAPI_OK )
j++;
if ( j == 1 &&
( retval = PAPI_add_event( EventSet, PAPI_L2_TCM ) ) != PAPI_OK ) {
if ( retval != PAPI_ECNFLCT )
test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
j--; /* The event was not added */
}
i = j;
if ( PAPI_query_event( PAPI_L2_DCM ) == PAPI_OK )
j++;
if ( j == ( i + 1 ) &&
( retval = PAPI_add_event( EventSet, PAPI_L2_DCM ) ) != PAPI_OK ) {
if ( retval != PAPI_ECNFLCT )
test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
j--; /* The event was not added */
}
if ( j ) {
if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_start", retval );
for ( i = 0; i < n; i++ ) {
c = a * b;
}
if (!TESTS_QUIET) fprintf(stdout,"c=%lf\n",c);
if ( ( retval = PAPI_stop( EventSet, g1 ) ) != PAPI_OK )
test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
}
test_pass( __FILE__, NULL, 0 );
exit( 1 );
}
开发者ID:DanieleDeSensi,项目名称:mammut,代码行数:55,代码来源:case1.c
注:本文中的PAPI_stop函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论