• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PAPI_cleanup_eventset函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PAPI_cleanup_eventset函数的典型用法代码示例。如果您正苦于以下问题:C++ PAPI_cleanup_eventset函数的具体用法?C++ PAPI_cleanup_eventset怎么用?C++ PAPI_cleanup_eventset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PAPI_cleanup_eventset函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: _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


示例2: free_energy_data

void free_energy_data(pwr_ctx_t *ctx) {
    if (ctx == NULL) {
        return;
    }

    if (!pwr_is_initialized(ctx, PWR_MODULE_ENERGY)) {
        ctx->error = PWR_UNINITIALIZED;
        return;
    }


    if (ctx->emeas_running) {
        pwr_stop_energy_count(ctx);
    }

    PAPI_cleanup_eventset(ctx->event_set);
    PAPI_destroy_eventset(&ctx->event_set);
    PAPI_shutdown();

    for (unsigned int i = 0; i < ctx->emeas->nbValues; ++i) {
        free(ctx->emeas->units[i]);
        free(ctx->emeas->names[i]);
    }
    free(ctx->emeas->values);
    free(ctx->emeas->units);
    free(ctx->emeas->names);
    free(ctx->emeas);

    ctx->error = PWR_OK;
}
开发者ID:reservoirlabs,项目名称:power-api,代码行数:30,代码来源:energy.c


示例3: PAPI_start_counters

int PAPI_start_counters(int *events, int array_len)
{
   int i, retval;
   HighLevelInfo *state = NULL;

   if ((retval = _internal_check_state(&state)) != PAPI_OK)
      return (retval);

   if(state->running != 0)
	return(PAPI_EINVAL);

   /* load events to the new EventSet */
   for (i = 0; i < array_len; i++) {
      retval = PAPI_add_event(state->EventSet, events[i]);
      if (retval == PAPI_EISRUN)
         return (retval);

      if (retval) {
         /* remove any prior events that may have been added 
          * and cleanup the high level information
          */
         _internal_cleanup_hl_info(state);
         PAPI_cleanup_eventset(state->EventSet);
         return (retval);
      }
   }
   /* start the EventSet */
   if ((retval = _internal_start_hl_counters(state)) == PAPI_OK) {
      state->running = HL_START_COUNTERS;
      state->num_evts = array_len;
   }
   return (retval);
}
开发者ID:tcreech,项目名称:papi-4.0.0-64-solaris11.2,代码行数:33,代码来源:papi_hl.c


示例4: 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


示例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: initialize_papi

void initialize_papi (int eventCode) {
  /* Initialize the PAPI library */
  retval = PAPI_library_init(PAPI_VER_CURRENT);
  if (retval != PAPI_VER_CURRENT) {
    fprintf(stderr, "PAPI library init error! %d\n",PAPI_EINVAL);
    handle_error(1);
  }
  
  if (EventSet==PAPI_NULL) {
  	if (PAPI_create_eventset(&EventSet) != PAPI_OK) {
	  	printf("PAPI create eventset error\n");
  	  handle_error(1);
  	}
  } else {
  	if (PAPI_cleanup_eventset(EventSet) != PAPI_OK) {
  		printf("PAPI cleanup error\n");
			handle_error(1);
		}
	}
	
  if (PAPI_add_event(EventSet, eventCode) != PAPI_OK) {
		printf("PAPI add event error: %x\n", eventCode);
    handle_error(1);
  }  
}
开发者ID:Ruekov,项目名称:hwquery,代码行数:25,代码来源:papif.c


示例7: 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


示例8: vt_metric_test

static void vt_metric_test(void)
{
    int i;
    int retval;
    int EventSet = PAPI_NULL;

    /* create event set */
    retval = PAPI_create_eventset(&EventSet);
    if ( retval != PAPI_OK)
        vt_metric_error(retval, "PAPI_create_eventset");

    for ( i = 0; i < nmetrics; i++ )
    {
        /* add event to event set */
        retval = PAPI_add_event(EventSet, metricv[i]->papi_code);
        if ( retval != PAPI_OK ) {
            char errstring[PAPI_MAX_STR_LEN];
            sprintf(errstring, "PAPI_add_event(%d:\"%s\")", i, metricv[i]->name);
            vt_metric_error(retval, errstring);
        }
        vt_cntl_msg("Event %s added to event set", metricv[i]->name);
    }
    retval = PAPI_cleanup_eventset(EventSet);
    if ( retval != PAPI_OK )
        vt_metric_error(retval, "PAPI_cleanup_eventset");

    retval = PAPI_destroy_eventset(&EventSet);
    if ( retval != PAPI_OK )
        vt_metric_error(retval, "PAPI_destroy_eventset");

    vt_cntl_msg("Event set tested OK");
}
开发者ID:rjrpaz,项目名称:MyOpenMPI,代码行数:32,代码来源:vt_metric_papi.c


示例9: mpx_remove_unused

/** Remove events that are not used any longer from the run 
 * list of events to multiplex by the handler
 * MUST BE CALLED WITH THE SIGNAL HANDLER DISABLED
 */
static void
mpx_remove_unused( MasterEvent ** head )
{
	MasterEvent *mev, *lastmev = NULL, *nextmev;
	Threadlist *thr = ( *head == NULL ) ? NULL : ( *head )->mythr;
	int retval;

	/* Clean up and remove unused master events. */
	for ( mev = *head; mev != NULL; mev = nextmev ) {
		nextmev = mev->next; /* get link before mev is freed */
		if ( !mev->uses ) {
			if ( lastmev == NULL ) {	/* this was the head event */
				*head = nextmev;
			} else {
				lastmev->next = nextmev;
			}
			retval=PAPI_cleanup_eventset( mev->papi_event );
			retval=PAPI_destroy_eventset( &( mev->papi_event ) );
			if (retval!=PAPI_OK) PAPIERROR("Error destroying event\n");
			papi_free( mev );
		} else {
			lastmev = mev;
		}
	}

	/* Always be sure the head master event points to the thread */
	if ( *head != NULL ) {
		( *head )->mythr = thr;
	}
}
开发者ID:DanieleDeSensi,项目名称:mammut,代码行数:34,代码来源:sw_multiplex.c


示例10: 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


示例11: 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


示例12: 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


示例13: 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


示例14: metric_test

/* Test whether requested event combination valid */
static void metric_test(void)
{
  int i, j;
  int retval;

  int component;
  struct eventmap_t * EventSet[VT_METRIC_MAXNUM];
  for (i=0; i<VT_METRIC_MAXNUM; i++)
    EventSet[i] = NULL;
  for (i=0; i < nmetrics; i++) {
#ifdef PAPIC
    /* Preset-counter belong to Component 0! */
    component = PAPI_COMPONENT_INDEX(metricv[i]->papi_code);
#else
    component = 0;
#endif
    /* search for the eventset that matches the counter */
    j=0;
    while (EventSet[j]!=NULL && j < VT_METRIC_MAXNUM && EventSet[j]->ComponentId!=component){
      j++;
    }
    if (EventSet[j]==NULL) /* create eventset, if no matching found */
    {
      EventSet[j] = malloc(sizeof(eventmap_t));
      EventSet[j]->EventId=PAPI_NULL;
      retval = PAPI_create_eventset(&(EventSet[j]->EventId));
      if ( retval != PAPI_OK)
        metric_error(retval, "PAPI_create_eventset");
      EventSet[j]->ComponentId=component;
    }
    /* add event to event set */
    retval = PAPI_add_event(EventSet[j]->EventId, metricv[i]->papi_code);
    if ( retval != PAPI_OK ) {
      char errstring[PAPI_MAX_STR_LEN];
      sprintf(errstring, "PAPI_add_event(%d:\"%s\")", i, metricv[i]->name);
      metric_error(retval, errstring);
    }
    vt_cntl_msg(2, "Event %s added to event set", metricv[i]->name);
  }
  /* foreach used eventset */
  for (i=0; i < VT_METRIC_MAXNUM && EventSet[i]!=NULL; i++)
  {
    retval = PAPI_cleanup_eventset(EventSet[i]->EventId);
    if ( retval != PAPI_OK )
      metric_error(retval, "PAPI_cleanup_eventset");

    retval = PAPI_destroy_eventset(&(EventSet[i]->EventId));
    if ( retval != PAPI_OK )
      metric_error(retval, "PAPI_destroy_eventset");
    free(EventSet[i]);
  }

  vt_cntl_msg(2, "Event set tested OK");
}
开发者ID:315234,项目名称:OpenFOAM-2.2.x-OSX,代码行数:55,代码来源:vt_metric_papi.c


示例15: check_event

static int
check_event( int event_code, char *name )
{
	int retval;
	char errstring[PAPI_MAX_STR_LEN];
	long long values;
	int EventSet = PAPI_NULL;

   /* Is there an issue with older machines? */
   /* Disable for now, add back once we can reproduce */
//	if ( PENTIUM4 ) {
//		if ( strcmp( name, "REPLAY_EVENT:BR_MSP" ) == 0 ) {
//			return 1;
//		}
//	}

	retval = PAPI_create_eventset( &EventSet );
	if ( retval != PAPI_OK )
	   test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
   
	retval = PAPI_add_event( EventSet, event_code );
	if ( retval != PAPI_OK ) {
		printf( "Error adding %s\n", name );
		return 0;
	} else {
	  //		printf( "Added %s successfully ", name );
	}

	retval = PAPI_start( EventSet );
	if ( retval != PAPI_OK ) {
		PAPI_perror( retval, errstring, PAPI_MAX_STR_LEN );
		fprintf( stdout, "Error starting %s : %s\n", name, errstring );
	} else {
		retval = PAPI_stop( EventSet, &values );
		if ( retval != PAPI_OK ) {
			PAPI_perror( retval, errstring, PAPI_MAX_STR_LEN );
			fprintf( stdout, "Error stopping %s: %s\n", name, errstring );
			return 0;
		} else {
			printf( "Added and Stopped %s successfully.\n", name );
		}
	}


	retval=PAPI_cleanup_eventset( EventSet );
	if (retval != PAPI_OK ) {
	  test_warn( __FILE__, __LINE__, "PAPI_cleanup_eventset", retval);
	}
	retval=PAPI_destroy_eventset( &EventSet );
	if (retval != PAPI_OK ) {
	  test_warn( __FILE__, __LINE__, "PAPI_destroy_eventset", retval);
	}
	return ( 1 );
}
开发者ID:naps62,项目名称:CPD_PAPI,代码行数:54,代码来源:all_native_events.c


示例16: destroy

        void destroy()
        {
            int ret;
            ret = PAPI_cleanup_eventset(eventSet);
            CHECK_PAPI_ERROR(ret, "PAPI_cleanup_eventset");

            ret = PAPI_destroy_eventset(&eventSet);
            CHECK_PAPI_ERROR(ret, "PAPI_destroy_eventset");

            PAPI_shutdown();
        }
开发者ID:tony1223yu,项目名称:GPGPU_MicroBenchmark_Suite,代码行数:11,代码来源:papi_wrapper.hpp


示例17: perf_destroy

void
perf_destroy(perf_t *perf)
{
  int retval;
  retval = PAPI_cleanup_eventset(perf->EventSet);
  assert(retval == PAPI_OK);

  retval = PAPI_destroy_eventset(&perf->EventSet);
  assert(retval == PAPI_OK);

  free(perf);
}
开发者ID:jiachengy,项目名称:numa-db,代码行数:12,代码来源:perf.c


示例18: test_papi_destroy

void test_papi_destroy(struct test_statistics_t *test_stat)
{
  int retval;
  
  if ((retval = PAPI_stop(test_stat->event_set, test_stat->counters)) != PAPI_OK)
    test_fail(__FILE__, __LINE__, "PAPI_stop", retval);

  if ((retval = PAPI_cleanup_eventset(test_stat->event_set)) != PAPI_OK)
    test_fail(__FILE__, __LINE__, "PAPI_destroy_eventset", retval);
  
  if ((retval = PAPI_destroy_eventset(&(test_stat->event_set))) != PAPI_OK)
    test_fail(__FILE__, __LINE__, "PAPI_destroy_eventset", retval);
}
开发者ID:costrouc,项目名称:HPC-Class,代码行数:13,代码来源:test.c


示例19: end_record_cache_access

void end_record_cache_access(RRecord & rr)
{
  int retVal;
  retVal = PAPI_stop(g_event_set, endRecords);
  assert(retVal == PAPI_OK);
  retVal = PAPI_cleanup_eventset(g_event_set);
  assert(retVal == PAPI_OK);
  retVal = PAPI_destroy_eventset(&g_event_set);
  assert(retVal == PAPI_OK);
  PAPI_shutdown(); 
  rr.put("L1-cache-misss", endRecords[0] - startRecords[0]);
  rr.put("L1-cache-access", endRecords[1] - startRecords[1]);
}
开发者ID:AthrunArthur,项目名称:functionflow,代码行数:13,代码来源:cache_eval.cpp


示例20: CheckInOrder

/*   CheckInOrder

     Check if we can add all the counters in the order given.
     This will just iterate through all counters trying to add them in the
     eventset.
*/
void CheckInOrder (int ncounters, unsigned *counters)
{
	int rc;
	int i;
	int naddedcounters;
	int EventSet = PAPI_NULL;
	char EventName[PAPI_MAX_STR_LEN];

#if 0
	fprintf (stdout, "\n** Checking in order the following counters: ");
	for (i = 0; i < ncounters; i++)
	{
		rc = PAPI_event_code_to_name (counters[i], EventName);
		if (rc == PAPI_OK)
			fprintf (stdout, "%s%s", i>0?",":"", EventName);
		else
			fprintf (stdout, "%s%08x", i>0?",":"", counters[i]);
	}
	fprintf (stdout, "\n");
#endif

	if (PAPI_create_eventset(&EventSet) != PAPI_OK)
	{
		fprintf (stderr, "Error! Failed to create the eventset!\n");
		return;
	}

	fprintf (stdout, "Suggested compatible counters preserving the given priority:\n");
	for (naddedcounters = 0, i = 0; i < ncounters; i++)
	{
		if (PAPI_add_event (EventSet, counters[i]) == PAPI_OK)
		{
			rc = PAPI_event_code_to_name (counters[i], EventName);
			if (rc == PAPI_OK)
				fprintf (stdout, "%s%s", i>0?",":"", EventName);
			else
				fprintf (stdout, "%s%08x", i>0?",":"", counters[i]);
			naddedcounters++;
		}
	}

	if (naddedcounters > 0)
		fprintf (stdout, " (set of %d counters)\n\n", naddedcounters);
	else
		fprintf (stdout, "NONE!\n\n");

	if (PAPI_cleanup_eventset(EventSet) != PAPI_OK)
		fprintf (stderr, "Error! Failed to cleanup the eventset\n");
	if (PAPI_destroy_eventset (&EventSet) != PAPI_OK)
		fprintf (stderr, "Error! Failed to destroy the eventset\n");
}
开发者ID:ElsevierSoftwareX,项目名称:SOFTX-D-15-00010,代码行数:57,代码来源:papi_best_set.c



注:本文中的PAPI_cleanup_eventset函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PAPI_create_eventset函数代码示例发布时间:2022-05-30
下一篇:
C++ PAPI_add_event函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap