コード例 #1
0
ファイル: linux-IOunit.c プロジェクト: jtombiamba/MABTools
int
IOUNIT_update_control_state( hwd_control_state_t * ptr,
						   NativeInfo_t * native, int count,
						   hwd_context_t * ctx )
{
#ifdef DEBUG_BGQ
	printf( "IOUNIT_update_control_state: count = %d\n", count );
#endif
	( void ) ctx;
	int retval, index, i;
	IOUNIT_control_state_t * this_state = ( IOUNIT_control_state_t * ) ptr;
	
	// Delete and re-create BGPM eventset
	_common_deleteRecreate( &this_state->EventGroup );
		
	// otherwise, add the events to the eventset
	for ( i = 0; i < count; i++ ) {
		index = ( native[i].ni_event ) + OFFSET;
		
		native[i].ni_position = i;

#ifdef DEBUG_BGQ
		printf("IOUNIT_update_control_state: ADD event: i = %d, index = %d\n", i, index );
#endif
				
		/* Add events to the BGPM eventGroup */
		retval = Bgpm_AddEvent( this_state->EventGroup, index );
		CHECK_BGPM_ERROR( retval, "Bgpm_AddEvent" );
	}
	
	return ( PAPI_OK );
}
コード例 #2
0
ファイル: linux-L2unit.c プロジェクト: FMCalisto/SMP
int
L2UNIT_update_control_state( hwd_control_state_t * ptr,
						   NativeInfo_t * native, int count,
						   hwd_context_t * ctx )
{
#ifdef DEBUG_BGQ
	printf( "L2UNIT_update_control_state: count = %d\n", count );
#endif	
	
	( void ) ctx;
	int retval, index, i, k;
	L2UNIT_control_state_t * this_state = ( L2UNIT_control_state_t * ) ptr;
	
	// Delete and re-create BGPM eventset
	_common_deleteRecreate( &this_state->EventGroup );

#ifdef DEBUG_BGQ
    printf( "L2UNIT_update_control_state: EventGroup=%d, overflow = %d\n",
		   this_state->EventGroup, this_state->overflow );
#endif
	
	
	// otherwise, add the events to the eventset
	for ( i = 0; i < count; i++ ) {
		index = ( native[i].ni_event ) + OFFSET;
		
		native[i].ni_position = i;
		
#ifdef DEBUG_BGQ
		printf("L2UNIT_update_control_state: ADD event: i = %d, index = %d\n", i, index );
#endif
		
		this_state->EventGroup_local[i] = index;

		
		/* Add events to the BGPM eventGroup */
		retval = Bgpm_AddEvent( this_state->EventGroup, index );
		CHECK_BGPM_ERROR( retval, "Bgpm_AddEvent" );
	}
	
	// store how many events we added to an EventSet
	this_state->count = count;

    // since update_control_state trashes overflow settings, this puts things
    // back into balance for BGPM
    if ( 1 == this_state->overflow ) {
        for ( k = 0; k < this_state->overflow_count; k++ ) {
            _common_set_overflow_BGPM( this_state->EventGroup,
                                      this_state->overflow_list[k].EventIndex,
                                      this_state->overflow_list[k].threshold,
                                      user_signal_handler_L2UNIT );
        }
    }
	
	return ( PAPI_OK );
}
コード例 #3
0
ファイル: linux-IOunit.c プロジェクト: jtombiamba/MABTools
/*
 * PAPI Cleanup Eventset
 *
 * Destroy and re-create the BGPM / IOunit EventSet
 */
int
IOUNIT_cleanup_eventset( hwd_control_state_t * ctrl )
{
#ifdef DEBUG_BGQ
	printf( "IOUNIT_cleanup_eventset\n" );
#endif
	
	IOUNIT_control_state_t * this_state = ( IOUNIT_control_state_t * ) ctrl;
		
	// create a new empty bgpm eventset
	// reason: bgpm doesn't permit to remove events from an eventset; 
	// hence we delete the old eventset and create a new one
	_common_deleteRecreate( &this_state->EventGroup ); // HJ try to use delete() only
	
	return ( PAPI_OK );
}
コード例 #4
0
ファイル: linux-L2unit.c プロジェクト: FMCalisto/SMP
/*
 * PAPI Cleanup Eventset
 * Destroy and re-create the BGPM / L2unit EventSet
 */
int
L2UNIT_cleanup_eventset( hwd_control_state_t * ctrl )
{
#ifdef DEBUG_BGQ
	printf( "L2UNIT_cleanup_eventset\n" );
#endif
	
	L2UNIT_control_state_t * this_state = ( L2UNIT_control_state_t * ) ctrl;
	
	// create a new empty bgpm eventset
	// reason: bgpm doesn't permit to remove events from an eventset; 
	// hence we delete the old eventset and create a new one
	_common_deleteRecreate( &this_state->EventGroup ); 

	// set overflow flag to OFF (0)
	this_state->overflow = 0;
    this_state->overflow_count = 0;
	// set BGPM eventGroup flag back to NOT applied yet (0)
	this_state->bgpm_eventset_applied = 0;
	
	return ( PAPI_OK );
}
コード例 #5
0
ファイル: linux-IOunit.c プロジェクト: bpgriner01/pbdPAPI
/*
 * PAPI Cleanup Eventset
 *
 * Destroy and re-create the BGPM / IOunit EventSet
 */
int
IOUNIT_cleanup_eventset( hwd_control_state_t * ctrl )
{
#ifdef DEBUG_BGQ
	printf( "IOUNIT_cleanup_eventset\n" );
#endif
	int retval;

	IOUNIT_control_state_t * this_state = ( IOUNIT_control_state_t * ) ctrl;
		
	// create a new empty bgpm eventset
	// reason: bgpm doesn't permit to remove events from an eventset; 
	// hence we delete the old eventset and create a new one
	retval = _common_deleteRecreate( &this_state->EventGroup ); // HJ try to use delete() only
	if ( retval < 0 ) return retval;

	// set overflow flag to OFF (0)
	this_state->overflow = 0;
    this_state->overflow_count = 0;
	
	return ( PAPI_OK );
}
コード例 #6
0
ファイル: linux-L2unit.c プロジェクト: FMCalisto/SMP
/*
 * Set Overflow
 *
 * This is commented out in BG/L/P - need to explore and complete...
 * However, with true 64-bit counters in BG/Q and all counters for PAPI
 * always starting from a true zero (we don't allow write...), the possibility
 * for overflow is remote at best...
 */
int
L2UNIT_set_overflow( EventSetInfo_t * ESI, int EventIndex, int threshold )
{
#ifdef DEBUG_BGQ
	printf("BEGIN L2UNIT_set_overflow\n");
#endif
	L2UNIT_control_state_t * this_state = ( L2UNIT_control_state_t * ) ESI->ctl_state;
	int retval;
	int evt_idx;
	
	/*
	 * In case an BGPM eventGroup HAS BEEN applied or attached before
	 * overflow is set, delete the eventGroup and create an new empty one,
	 * and rebuild as it was prior to deletion
	 */
#ifdef DEBUG_BGQ
	printf( "L2UNIT_set_overflow: bgpm_eventset_applied = %d, threshold = %d\n",
		   this_state->bgpm_eventset_applied, threshold );
#endif	
	if ( 1 == this_state->bgpm_eventset_applied && 0 != threshold ) {
		_common_deleteRecreate( &this_state->EventGroup );
		_common_rebuildEventgroup( this_state->count,
								  this_state->EventGroup_local,
								  &this_state->EventGroup );
		
		/* set BGPM eventGroup flag back to NOT applied yet (0) 
		 * because the eventGroup has been recreated from scratch */
		this_state->bgpm_eventset_applied = 0;
	}
		
	evt_idx = ESI->EventInfoArray[EventIndex].pos[0];
	SUBDBG( "Hardware counter %d (vs %d) used in overflow, threshold %d\n",
		   evt_idx, EventIndex, threshold );
#ifdef DEBUG_BGQ
	printf( "Hardware counter %d (vs %d) used in overflow, threshold %d\n",
		   evt_idx, EventIndex, threshold );
#endif
	/* If this counter isn't set to overflow, it's an error */
	if ( threshold == 0 ) {
		/* Remove the signal handler */
		retval = _papi_hwi_stop_signal( _L2unit_vector.cmp_info.hardware_intr_sig );
		if ( retval != PAPI_OK )
			return ( retval );
	}
	else {
		this_state->overflow = 1;
        this_state->overflow_count++;
		this_state->overflow_list[this_state->overflow_count-1].threshold = threshold;
		this_state->overflow_list[this_state->overflow_count-1].EventIndex = evt_idx;
		
#ifdef DEBUG_BGQ
		printf( "L2UNIT_set_overflow: Enable the signal handler\n" );
#endif
		/* Enable the signal handler */
		retval = _papi_hwi_start_signal( _L2unit_vector.cmp_info.hardware_intr_sig, 
										NEED_CONTEXT, 
										_L2unit_vector.cmp_info.CmpIdx );
		if ( retval != PAPI_OK )
			return ( retval );

        _common_set_overflow_BGPM( this_state->EventGroup,
                                  this_state->overflow_list[this_state->overflow_count-1].EventIndex,
                                  this_state->overflow_list[this_state->overflow_count-1].threshold,
                                  user_signal_handler_L2UNIT );
	}
	
	return ( PAPI_OK );
}