Blame man/man3/PAPI_sprofil.3

Packit 577717
.TH "PAPI_sprofil" 3 "Mon Dec 18 2017" "Version 5.6.0.0" "PAPI" \" -*- nroff -*-
Packit 577717
.ad l
Packit 577717
.nh
Packit 577717
.SH NAME
Packit 577717
PAPI_sprofil \- 
Packit 577717
.PP
Packit 577717
Generate PC histogram data from multiple code regions where hardware counter overflow occurs\&.  
Packit 577717
Packit 577717
.SH SYNOPSIS
Packit 577717
.br
Packit 577717
.PP
Packit 577717
.SH "Detailed Description"
Packit 577717
.PP 
Packit 577717
Packit 577717
.PP
Packit 577717
\fBC Interface:\fP
Packit 577717
.RS 4
Packit 577717
#include <\fBpapi\&.h\fP> 
Packit 577717
.br
Packit 577717
 int \fBPAPI_sprofil( PAPI_sprofil_t * prof, int profcnt, int EventSet, int EventCode, int threshold, int flags )\fP;
Packit 577717
.RE
Packit 577717
.PP
Packit 577717
\fBParameters:\fP
Packit 577717
.RS 4
Packit 577717
\fI*prof\fP pointer to an array of \fBPAPI_sprofil_t\fP structures\&. Each copy of the structure contains the following: 
Packit 577717
.PD 0
Packit 577717
Packit 577717
.IP "\(bu" 2
Packit 577717
buf -- pointer to a buffer of bufsiz bytes in which the histogram counts are stored in an array of unsigned short, unsigned int, or unsigned long long values, or 'buckets'\&. The size of the buckets is determined by values in the flags argument\&. 
Packit 577717
.IP "\(bu" 2
Packit 577717
bufsiz -- the size of the histogram buffer in bytes\&. It is computed from the length of the code region to be profiled, the size of the buckets, and the scale factor as discussed below\&. 
Packit 577717
.IP "\(bu" 2
Packit 577717
offset -- the start address of the region to be profiled\&. 
Packit 577717
.IP "\(bu" 2
Packit 577717
scale -- broadly and historically speaking, a contraction factor that indicates how much smaller the histogram buffer is than the region to be profiled\&. More precisely, scale is interpreted as an unsigned 16-bit fixed-point fraction with the decimal point implied on the left\&. Its value is the reciprocal of the number of addresses in a subdivision, per counter of histogram buffer\&.
Packit 577717
.PP
Packit 577717
.br
Packit 577717
\fIprofcnt\fP number of structures in the prof array for hardware profiling\&. 
Packit 577717
.br
Packit 577717
\fIEventSet\fP The PAPI EventSet to profile\&. This EventSet is marked as profiling-ready, but profiling doesn't actually start until a \fBPAPI_start()\fP call is issued\&. 
Packit 577717
.br
Packit 577717
\fIEventCode\fP Code of the Event in the EventSet to profile\&. This event must already be a member of the EventSet\&. 
Packit 577717
.br
Packit 577717
\fIthreshold\fP minimum number of events that must occur before the PC is sampled\&. If hardware overflow is supported for your component, this threshold will trigger an interrupt when reached\&. Otherwise, the counters will be sampled periodically and the PC will be recorded for the first sample that exceeds the threshold\&. If the value of threshold is 0, profiling will be disabled for this event\&. 
Packit 577717
.br
Packit 577717
\fIflags\fP bit pattern to control profiling behavior\&. Defined values are given in a table in the documentation for PAPI_pofil  
Packit 577717
 
Packit 577717
    
Packit 577717
.RE
Packit 577717
.PP
Packit 577717
\fBReturn values:\fP
Packit 577717
.RS 4
Packit 577717
\fIReturn\fP values for \fBPAPI_sprofil()\fP are identical to those for \fBPAPI_profil\fP\&. Please refer to that page for further details\&.  
Packit 577717
 
Packit 577717
    
Packit 577717
.RE
Packit 577717
.PP
Packit 577717
\fBPAPI_sprofil()\fP is a structure driven profiler that profiles one or more disjoint regions of code in a single call\&. It accepts a pointer to a preinitialized array of sprofil structures, and initiates profiling based on the values contained in the array\&. Each structure in the array defines the profiling parameters that are normally passed to \fBPAPI_profil()\fP\&. For more information on profiling, \fBPAPI_profil\fP  
Packit 577717
 
Packit 577717
    
Packit 577717
.PP
Packit 577717
\fBExample:\fP
Packit 577717
.RS 4
Packit 577717
Packit 577717
.PP
Packit 577717
.nf
Packit 577717
* int retval;
Packit 577717
* unsigned long length;
Packit 577717
* PAPI_exe_info_t *prginfo;
Packit 577717
* unsigned short *profbuf1, *profbuf2, profbucket;
Packit 577717
* PAPI_sprofil_t sprof[3];
Packit 577717
*
Packit 577717
* prginfo = PAPI_get_executable_info();
Packit 577717
* if (prginfo == NULL) handle_error( NULL );
Packit 577717
* length = (unsigned long)(prginfo->text_end - prginfo->text_start);
Packit 577717
* // Allocate 2 buffers of equal length
Packit 577717
* profbuf1 = (unsigned short *)malloc(length);
Packit 577717
* profbuf2 = (unsigned short *)malloc(length);
Packit 577717
* if ((profbuf1 == NULL) || (profbuf2 == NULL))
Packit 577717
*   handle_error( NULL );
Packit 577717
* memset(profbuf1,0x00,length);
Packit 577717
* memset(profbuf2,0x00,length);
Packit 577717
* // First buffer
Packit 577717
* sprof[0]\&.pr_base = profbuf1;
Packit 577717
* sprof[0]\&.pr_size = length;
Packit 577717
* sprof[0]\&.pr_off = (caddr_t) DO_FLOPS;
Packit 577717
* sprof[0]\&.pr_scale = 0x10000;
Packit 577717
* // Second buffer
Packit 577717
* sprof[1]\&.pr_base = profbuf2;
Packit 577717
* sprof[1]\&.pr_size = length;
Packit 577717
* sprof[1]\&.pr_off = (caddr_t) DO_READS;
Packit 577717
* sprof[1]\&.pr_scale = 0x10000;
Packit 577717
* // Overflow bucket
Packit 577717
* sprof[2]\&.pr_base = profbucket;
Packit 577717
* sprof[2]\&.pr_size = 1;
Packit 577717
* sprof[2]\&.pr_off = 0;
Packit 577717
* sprof[2]\&.pr_scale = 0x0002;
Packit 577717
* retval = PAPI_sprofil(sprof, EventSet, PAPI_FP_INS, 1000000,
Packit 577717
* PAPI_PROFIL_POSIX | PAPI_PROFIL_BUCKET_16)) != PAPI_OK)
Packit 577717
* if ( retval != PAPI_OK ) handle_error( retval );
Packit 577717
* 
Packit 577717
Packit 577717
.fi
Packit 577717
.PP
Packit 577717
.RE
Packit 577717
.PP
Packit 577717
\fBSee Also:\fP
Packit 577717
.RS 4
Packit 577717
\fBPAPI_overflow\fP 
Packit 577717
.PP
Packit 577717
\fBPAPI_get_executable_info\fP 
Packit 577717
.PP
Packit 577717
\fBPAPI_profil\fP 
Packit 577717
.RE
Packit 577717
.PP
Packit 577717
Packit 577717
Packit 577717
.SH "Author"
Packit 577717
.PP 
Packit 577717
Generated automatically by Doxygen for PAPI from the source code\&.