コード例 #1
0
ファイル: Handler.c プロジェクト: gzt200361/ThirdParty-2.0.0
int handleDefcounter( void* firsthandlerarg, uint32_t streamid,
		uint32_t deftoken, const char* name, uint32_t properties, 
		uint32_t countergroup, const char* unit ) {


	uint64_t valuebounds[2]= { (uint64_t) 0, (uint64_t) -1 };

	int dodifferentiation;
	int datarephint;


	static int first= 1;
	
		if ( 1 == first ) {
			first= 0;
			fprintf( stderr, "translation of performance counter "
				"definitions not fully supported\n" );
		}
		
	dodifferentiation= 
		( OTF_COUNTER_TYPE_ACC == ( properties & OTF_COUNTER_TYPE_BITS ) ) ? 1 : 0;
		
	if ( OTF_COUNTER_SCOPE_START == ( properties & OTF_COUNTER_SCOPE_BITS ) ) {
		
		datarephint = VTF3_DATAREPHINT_SAMPLE;	

	} else if ( OTF_COUNTER_SCOPE_LAST == ( properties & OTF_COUNTER_SCOPE_BITS	) ) {
	
		datarephint = VTF3_DATAREPHINT_BEFORE;

	} else {

		datarephint = VTF3_DATAREPHINT_SAMPLE; /* standard value */
		
		fprintf( stderr, "otf2vtf: %s WARNING for counter def %u: "
			"counter type not supported\n", __PRETTY_FUNCTION__, deftoken );
	}

	return ( 0 == VTF3_WriteDefsamp( ((fcbT*) firsthandlerarg)->fcb,
		deftoken /* int sampletoken */,
		countergroup /* int sampleclasstoken */,
		0 /* int iscpugrpsamp */,
		0 /* unsigned int cpuorcpugrpid */,
		VTF3_VALUETYPE_UINT /* int valuetype */,
		valuebounds /* const void *valuebounds */,
		dodifferentiation /* int dodifferentiation */,
		datarephint /* int datarephint */,
		name /* const char *samplename */,
		unit /* const char *sampleunit  */ ) )
		? OTF_RETURN_ABORT : OTF_RETURN_OK;
}
コード例 #2
0
ファイル: elg_vtf3.c プロジェクト: linearregression/scalasca
static void conv_write_metrics() {
  int i, j = 0;

  if ( maxmet != -1 ) {
    metids = x_malloc((maxmet+1) * sizeof(int));
    metvts = x_malloc((maxmet+1) * sizeof(int));

    wbytes += VTF3_WriteDefsampclass(fcb, 0, "HW Counters");

    for (i=0; i<nummet; i++) {
      if ( mettab[i].name ) {
        metids[j] = i;
        metvts[j++] = type2vtf[mettab[i].type];
        wbytes += VTF3_WriteDefsamp(fcb, i, 0, 1, samplegroup,
              type2vtf[mettab[i].type],
              (mettab[i].type == ELG_INTEGER ? (void*)&intlim : (void*)&fltlim),
              (mettab[i].iv == ELG_START), VTF3_DATAREPHINT_BEFORE,
              mettab[i].name, (mettab[i].iv == ELG_START ? "#/s" : ""));
      }
    }
  }
}