|
Packit Service |
a1973e |
.TH "PAPI_sprofil" 3 "Mon Dec 18 2017" "Version 5.6.0.0" "PAPI" \" -*- nroff -*-
|
|
Packit Service |
a1973e |
.ad l
|
|
Packit Service |
a1973e |
.nh
|
|
Packit Service |
a1973e |
.SH NAME
|
|
Packit Service |
a1973e |
PAPI_sprofil \-
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
Generate PC histogram data from multiple code regions where hardware counter overflow occurs\&.
|
|
Packit Service |
a1973e |
|
|
Packit Service |
a1973e |
.SH SYNOPSIS
|
|
Packit Service |
a1973e |
.br
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
.SH "Detailed Description"
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
\fBC Interface:\fP
|
|
Packit Service |
a1973e |
.RS 4
|
|
Packit Service |
a1973e |
#include <\fBpapi\&.h\fP>
|
|
Packit Service |
a1973e |
.br
|
|
Packit Service |
a1973e |
int \fBPAPI_sprofil( PAPI_sprofil_t * prof, int profcnt, int EventSet, int EventCode, int threshold, int flags )\fP;
|
|
Packit Service |
a1973e |
.RE
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
\fBParameters:\fP
|
|
Packit Service |
a1973e |
.RS 4
|
|
Packit Service |
a1973e |
\fI*prof\fP pointer to an array of \fBPAPI_sprofil_t\fP structures\&. Each copy of the structure contains the following:
|
|
Packit Service |
a1973e |
.PD 0
|
|
Packit Service |
a1973e |
|
|
Packit Service |
a1973e |
.IP "\(bu" 2
|
|
Packit Service |
a1973e |
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 Service |
a1973e |
.IP "\(bu" 2
|
|
Packit Service |
a1973e |
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 Service |
a1973e |
.IP "\(bu" 2
|
|
Packit Service |
a1973e |
offset -- the start address of the region to be profiled\&.
|
|
Packit Service |
a1973e |
.IP "\(bu" 2
|
|
Packit Service |
a1973e |
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 Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
.br
|
|
Packit Service |
a1973e |
\fIprofcnt\fP number of structures in the prof array for hardware profiling\&.
|
|
Packit Service |
a1973e |
.br
|
|
Packit Service |
a1973e |
\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 Service |
a1973e |
.br
|
|
Packit Service |
a1973e |
\fIEventCode\fP Code of the Event in the EventSet to profile\&. This event must already be a member of the EventSet\&.
|
|
Packit Service |
a1973e |
.br
|
|
Packit Service |
a1973e |
\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 Service |
a1973e |
.br
|
|
Packit Service |
a1973e |
\fIflags\fP bit pattern to control profiling behavior\&. Defined values are given in a table in the documentation for PAPI_pofil
|
|
Packit Service |
a1973e |
|
|
Packit Service |
a1973e |
|
|
Packit Service |
a1973e |
.RE
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
\fBReturn values:\fP
|
|
Packit Service |
a1973e |
.RS 4
|
|
Packit Service |
a1973e |
\fIReturn\fP values for \fBPAPI_sprofil()\fP are identical to those for \fBPAPI_profil\fP\&. Please refer to that page for further details\&.
|
|
Packit Service |
a1973e |
|
|
Packit Service |
a1973e |
|
|
Packit Service |
a1973e |
.RE
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
\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 Service |
a1973e |
|
|
Packit Service |
a1973e |
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
\fBExample:\fP
|
|
Packit Service |
a1973e |
.RS 4
|
|
Packit Service |
a1973e |
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
.nf
|
|
Packit Service |
a1973e |
* int retval;
|
|
Packit Service |
a1973e |
* unsigned long length;
|
|
Packit Service |
a1973e |
* PAPI_exe_info_t *prginfo;
|
|
Packit Service |
a1973e |
* unsigned short *profbuf1, *profbuf2, profbucket;
|
|
Packit Service |
a1973e |
* PAPI_sprofil_t sprof[3];
|
|
Packit Service |
a1973e |
*
|
|
Packit Service |
a1973e |
* prginfo = PAPI_get_executable_info();
|
|
Packit Service |
a1973e |
* if (prginfo == NULL) handle_error( NULL );
|
|
Packit Service |
a1973e |
* length = (unsigned long)(prginfo->text_end - prginfo->text_start);
|
|
Packit Service |
a1973e |
* // Allocate 2 buffers of equal length
|
|
Packit Service |
a1973e |
* profbuf1 = (unsigned short *)malloc(length);
|
|
Packit Service |
a1973e |
* profbuf2 = (unsigned short *)malloc(length);
|
|
Packit Service |
a1973e |
* if ((profbuf1 == NULL) || (profbuf2 == NULL))
|
|
Packit Service |
a1973e |
* handle_error( NULL );
|
|
Packit Service |
a1973e |
* memset(profbuf1,0x00,length);
|
|
Packit Service |
a1973e |
* memset(profbuf2,0x00,length);
|
|
Packit Service |
a1973e |
* // First buffer
|
|
Packit Service |
a1973e |
* sprof[0]\&.pr_base = profbuf1;
|
|
Packit Service |
a1973e |
* sprof[0]\&.pr_size = length;
|
|
Packit Service |
a1973e |
* sprof[0]\&.pr_off = (caddr_t) DO_FLOPS;
|
|
Packit Service |
a1973e |
* sprof[0]\&.pr_scale = 0x10000;
|
|
Packit Service |
a1973e |
* // Second buffer
|
|
Packit Service |
a1973e |
* sprof[1]\&.pr_base = profbuf2;
|
|
Packit Service |
a1973e |
* sprof[1]\&.pr_size = length;
|
|
Packit Service |
a1973e |
* sprof[1]\&.pr_off = (caddr_t) DO_READS;
|
|
Packit Service |
a1973e |
* sprof[1]\&.pr_scale = 0x10000;
|
|
Packit Service |
a1973e |
* // Overflow bucket
|
|
Packit Service |
a1973e |
* sprof[2]\&.pr_base = profbucket;
|
|
Packit Service |
a1973e |
* sprof[2]\&.pr_size = 1;
|
|
Packit Service |
a1973e |
* sprof[2]\&.pr_off = 0;
|
|
Packit Service |
a1973e |
* sprof[2]\&.pr_scale = 0x0002;
|
|
Packit Service |
a1973e |
* retval = PAPI_sprofil(sprof, EventSet, PAPI_FP_INS, 1000000,
|
|
Packit Service |
a1973e |
* PAPI_PROFIL_POSIX | PAPI_PROFIL_BUCKET_16)) != PAPI_OK)
|
|
Packit Service |
a1973e |
* if ( retval != PAPI_OK ) handle_error( retval );
|
|
Packit Service |
a1973e |
*
|
|
Packit Service |
a1973e |
|
|
Packit Service |
a1973e |
.fi
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
.RE
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
\fBSee Also:\fP
|
|
Packit Service |
a1973e |
.RS 4
|
|
Packit Service |
a1973e |
\fBPAPI_overflow\fP
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
\fBPAPI_get_executable_info\fP
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
\fBPAPI_profil\fP
|
|
Packit Service |
a1973e |
.RE
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
|
|
Packit Service |
a1973e |
|
|
Packit Service |
a1973e |
.SH "Author"
|
|
Packit Service |
a1973e |
.PP
|
|
Packit Service |
a1973e |
Generated automatically by Doxygen for PAPI from the source code\&.
|