示例#1
0
int handleFileOperation( void* fcb, uint64_t time, uint32_t fileid,
	uint32_t process, uint64_t handleid, uint32_t operation, uint64_t bytes,
	uint64_t duration, uint32_t source ) {


	return ( 0 == OTF_Writer_writeFileOperation( ((fcbT*) fcb)->writer, time, fileid,
		process, handleid, operation, bytes, duration, source ) )
		? OTF_RETURN_ABORT : OTF_RETURN_OK;
}
示例#2
0
int handleFileiobegin( void *fcbx, double time, unsigned int cpuid,
		int fileiotype, int iofiletoken, int bytescopied, int scltoken ) {


	int cpu = (cpuid&0xffff);
	int thread = (cpuid>>16)&0xffff;
	uint32_t otfiotype;
	fcbT* fcb= (fcbT*) fcbx;
	processT* proc= &((fcbT*)fcb)->processes[cpu][thread];
	uint64_t duration;

	if( 0 == fcb->ioonly ) {

		if( VTF3_FILEIOTYPE_READ == fileiotype ) {
			otfiotype= OTF_FILEOP_READ;
		} else if ( VTF3_FILEIOTYPE_WRITE == fileiotype ) {
			otfiotype= OTF_FILEOP_WRITE;
		} else {
			fprintf( stderr, "ERROR: fileiobegin: unknown fileiotype %i.skipping.\n", fileiotype );
			return 0;
		}


		/* re-read the extra information if there is nothing left */
		if( proc->fileIObufferpos >= proc->fileIObufferlen ) {

			readFileIOBuffer( cpuid, proc, fcb->outputFile );
		}


		++cpuid;
		++iofiletoken;

		if( proc->fileIObufferpos >= proc->fileIObufferlen ) {
			duration= 0;
		} else if ( time == proc->fileIObuffer[proc->fileIObufferpos] ) {
			duration= proc->fileIObuffer[proc->fileIObufferpos+1];
		} else {
			duration= 0;
		}
		
		OTF_Writer_writeFileOperation( fcb->writer, time, iofiletoken, cpuid,
			fcb->handleid, otfiotype, (uint64_t) bytescopied, duration,
			(uint32_t) scltoken );

		++fcb->handleid;
		++proc->fileIObufferpos;

	
	} else {

		/* 1 == fcb->ioonly */

		if( proc->fileIObegin == (uint64_t) -1 ) {
		
			proc->fileIObegin= time; /* set starttimestamp */
			
		} else {
		
			fprintf( stderr, "ERROR: fileiobegin after fileiobegin (without end in between). Overwriting.\n" );
			return 0;
			
		}
		
	}

	return 0;
}