PAPI 7.1.0.0
Loading...
Searching...
No Matches
prof_utils.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FULL_SCALE   65536
 

Functions

int prof_events (int num_tests)
 
void prof_print_address (const char *title, const PAPI_exe_info_t *prginfo)
 
void prof_print_prof_info (vptr_t start, vptr_t end, int threshold, char *event_name)
 
void prof_alloc (int num, unsigned long plength)
 
void prof_head (unsigned long blength, int bucket_size, int num_buckets, const char *header)
 
void prof_out (vptr_t start, int n, int bucket, int num_buckets, unsigned int scale)
 
unsigned long prof_size (unsigned long plength, unsigned scale, int bucket, int *num_buckets)
 
int prof_check (int n, int bucket, int num_buckets)
 
int prof_buckets (int bucket)
 
void do_no_profile (int quiet)
 

Variables

long long ** values
 
char event_name [PAPI_MAX_STR_LEN]
 
int PAPI_event
 
int EventSet
 
void * profbuf [5]
 

Macro Definition Documentation

◆ FULL_SCALE

#define FULL_SCALE   65536

Definition at line 20 of file prof_utils.h.

Function Documentation

◆ do_no_profile()

void do_no_profile ( int  quiet)

Definition at line 113 of file prof_utils.c.

114{
115 int retval;
116
117 if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK )
118 test_fail( __FILE__, __LINE__, "PAPI_start", retval );
119
120 do_flops( getenv( "NUM_ITERS" ) ? atoi( getenv( "NUM_ITERS" ) ) :
121 NUM_ITERS );
122
123 if ( ( retval = PAPI_stop( EventSet, values[0] ) ) != PAPI_OK )
124 test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
125
126 if (!quiet) {
127 printf( "Test type : \t%s\n", "No profiling" );
128 printf( TAB1, event_name, ( values[0] )[0] );
129 printf( TAB1, "PAPI_TOT_CYC", ( values[0] )[1] );
130 }
131}
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
#define PAPI_OK
Definition: f90papi.h:73
void do_flops(int n)
Definition: multiplex.c:23
#define NUM_ITERS
Definition: multiplex.c:19
#define TAB1
Definition: papi_test.h:98
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:491
int EventSet
Definition: prof_utils.c:32
char event_name[PAPI_MAX_STR_LEN]
Definition: prof_utils.c:30
long long ** values
Definition: prof_utils.c:29
int quiet
Definition: rapl_overflow.c:19
int retval
Definition: zero_fork.c:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prof_alloc()

void prof_alloc ( int  num,
unsigned long  plength 
)

Definition at line 140 of file prof_utils.c.

141{
142 int i;
143
144 for ( i = 0; i < num; i++ ) {
145 profbuf[i] = malloc( blength );
146 if ( profbuf[i] == NULL ) {
147 test_fail( __FILE__, __LINE__, "malloc", PAPI_ESYS );
148 }
149 memset( profbuf[i], 0x00, blength );
150 }
151}
int i
#define PAPI_ESYS
Definition: f90papi.h:136
void * profbuf[5]
Definition: prof_utils.c:33
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prof_buckets()

int prof_buckets ( int  bucket)

Definition at line 160 of file prof_utils.c.

161{
162 int bucket_size;
163 switch ( bucket ) {
165 bucket_size = sizeof ( short );
166 break;
168 bucket_size = sizeof ( int );
169 break;
171 bucket_size = sizeof ( unsigned long long );
172 break;
173 default:
174 bucket_size = 0;
175 break;
176 }
177 return ( bucket_size );
178}
#define PAPI_PROFIL_BUCKET_32
Definition: f90papi.h:248
#define PAPI_PROFIL_BUCKET_16
Definition: f90papi.h:144
#define PAPI_PROFIL_BUCKET_64
Definition: f90papi.h:198
int
Definition: sde_internal.h:89
long long int long long
Definition: sde_internal.h:85
Here is the caller graph for this function:

◆ prof_check()

int prof_check ( int  n,
int  bucket,
int  num_buckets 
)

Definition at line 272 of file prof_utils.c.

273{
274 int i, j;
275 int retval = 0;
276 unsigned short **buf16 = ( unsigned short ** ) profbuf;
277 unsigned int **buf32 = ( unsigned int ** ) profbuf;
278 unsigned long long **buf64 = ( unsigned long long ** ) profbuf;
279
280 switch ( bucket ) {
282 for ( i = 0; i < num_buckets; i++ )
283 for ( j = 0; j < n; j++ )
284 retval = retval || buf16[j][i];
285 break;
287 for ( i = 0; i < num_buckets; i++ )
288 for ( j = 0; j < n; j++ )
289 retval = retval || buf32[j][i];
290 break;
292 for ( i = 0; i < num_buckets; i++ )
293 for ( j = 0; j < n; j++ )
294 retval = retval || buf64[j][i];
295 break;
296 }
297 return ( retval );
298}
Here is the caller graph for this function:

◆ prof_events()

int prof_events ( int  num_tests)

Definition at line 42 of file prof_utils.c.

43{
44 int retval;
45 int num_events, mask;
46
47 /* add PAPI_TOT_CYC and one of the events in PAPI_FP_INS, PAPI_FP_OPS or
48 PAPI_TOT_INS, depends on the availability of the event on the
49 platform */
51
52 if (num_events==0) {
53 return 0;
54 }
55
57
59 if (retval != PAPI_OK ) {
60 test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval );
61 }
62
63 return mask;
64}
Convert a numeric hardware event code to a name.
static int num_events
int add_two_nonderived_events(int *num_events, int *papi_event, int *mask)
Definition: test_utils.c:671
long long ** allocate_test_space(int num_tests, int num_events)
Definition: test_utils.c:46
int PAPI_event
Definition: prof_utils.c:31
int num_tests
Definition: zero_fork.c:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prof_head()

void prof_head ( unsigned long  blength,
int  bucket_size,
int  num_buckets,
const char *  header 
)

Definition at line 183 of file prof_utils.c.

184{
185 int bucket_size = prof_buckets( bucket );
186 printf
187 ( "\n------------------------------------------------------------\n" );
188 printf( "PAPI_profil() hash table, Bucket size: %d bits.\n",
189 bucket_size * 8 );
190 printf( "Number of buckets: %d.\nLength of buffer: %ld bytes.\n",
191 num_buckets, blength );
192 printf( "------------------------------------------------------------\n" );
193 printf( "%s\n", header );
194}
int prof_buckets(int bucket)
Definition: prof_utils.c:160
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prof_out()

void prof_out ( vptr_t  start,
int  n,
int  bucket,
int  num_buckets,
unsigned int  scale 
)

Definition at line 202 of file prof_utils.c.

204{
205 int i, j;
206 unsigned short buf_16;
207 unsigned int buf_32;
208 unsigned long long buf_64;
209 unsigned short **buf16 = ( unsigned short ** ) profbuf;
210 unsigned int **buf32 = ( unsigned int ** ) profbuf;
211 unsigned long long **buf64 = ( unsigned long long ** ) profbuf;
212
213 if ( !TESTS_QUIET ) {
214 /* printf("%#lx\n",(unsigned long) start + (unsigned long) (2 * i)); */
215 /* printf("start: %p; i: %#x; scale: %#x; i*scale: %#x; i*scale >>15: %#x\n", start, i, scale, i*scale, (i*scale)>>15); */
216 switch ( bucket ) {
218 for ( i = 0; i < num_buckets; i++ ) {
219 for ( j = 0, buf_16 = 0; j < n; j++ )
220 buf_16 |= ( buf16[j] )[i];
221 if ( buf_16 ) {
222/* On 32bit builds with gcc 4.3 gcc complained about casting vptr_t => long long
223 * Thus the unsigned long to long long cast */
224 printf( "%#-16llx",
225 (long long) (unsigned long)start +
226 ( ( ( long long ) i * scale ) >> 15 ) );
227 for ( j = 0, buf_16 = 0; j < n; j++ )
228 printf( "\t%d", ( buf16[j] )[i] );
229 printf( "\n" );
230 }
231 }
232 break;
234 for ( i = 0; i < num_buckets; i++ ) {
235 for ( j = 0, buf_32 = 0; j < n; j++ )
236 buf_32 |= ( buf32[j] )[i];
237 if ( buf_32 ) {
238 printf( "%#-16llx",
239 (long long) (unsigned long)start +
240 ( ( ( long long ) i * scale ) >> 15 ) );
241 for ( j = 0, buf_32 = 0; j < n; j++ )
242 printf( "\t%d", ( buf32[j] )[i] );
243 printf( "\n" );
244 }
245 }
246 break;
248 for ( i = 0; i < num_buckets; i++ ) {
249 for ( j = 0, buf_64 = 0; j < n; j++ )
250 buf_64 |= ( buf64[j] )[i];
251 if ( buf_64 ) {
252 printf( "%#-16llx",
253 (long long) (unsigned long)start +
254 ( ( ( long long ) i * scale ) >> 15 ) );
255 for ( j = 0, buf_64 = 0; j < n; j++ )
256 printf( "\t%lld", ( buf64[j] )[i] );
257 printf( "\n" );
258 }
259 }
260 break;
261 }
262 printf
263 ( "------------------------------------------------------------\n\n" );
264 }
265}
static struct timeval start
int TESTS_QUIET
Definition: test_utils.c:18
Here is the caller graph for this function:

◆ prof_print_address()

void prof_print_address ( const char *  title,
const PAPI_exe_info_t prginfo 
)

Definition at line 69 of file prof_utils.c.

70{
71 printf( "%s\n", title );
72 printf
73 ( "----------------------------------------------------------------\n" );
74 printf( "Text start: %p, Text end: %p, Text length: %#x\n",
76 ( unsigned int ) ( prginfo->address_info.text_end -
77 prginfo->address_info.text_start ) );
78 printf( "Data start: %p, Data end: %p\n", prginfo->address_info.data_start,
79 prginfo->address_info.data_end );
80 printf( "BSS start : %p, BSS end : %p\n", prginfo->address_info.bss_start,
81 prginfo->address_info.bss_end );
82
83 printf
84 ( "----------------------------------------------------------------\n" );
85}
vptr_t text_start
Definition: papi.h:686
vptr_t text_end
Definition: papi.h:687
vptr_t bss_start
Definition: papi.h:690
vptr_t data_end
Definition: papi.h:689
vptr_t data_start
Definition: papi.h:688
vptr_t bss_end
Definition: papi.h:691
PAPI_address_map_t address_info
Definition: papi.h:698
Here is the caller graph for this function:

◆ prof_print_prof_info()

void prof_print_prof_info ( vptr_t  start,
vptr_t  end,
int  threshold,
char *  event_name 
)

Definition at line 93 of file prof_utils.c.

95{
96 printf( "Profiling event : %s\n", event_name );
97 printf( "Profile Threshold: %d\n", threshold );
98 printf( "Profile Iters : %d\n",
99 ( getenv( "NUM_ITERS" ) ? atoi( getenv( "NUM_ITERS" ) ) :
100 NUM_ITERS ) );
101 printf( "Profile Range : %p to %p\n", start, end );
102 printf
103 ( "----------------------------------------------------------------\n" );
104 printf( "\n" );
105}
static int threshold
Here is the caller graph for this function:

◆ prof_size()

unsigned long prof_size ( unsigned long  plength,
unsigned  scale,
int  bucket,
int num_buckets 
)

Definition at line 310 of file prof_utils.c.

311{
312 unsigned long blength;
313 long long llength = ( ( long long ) plength * scale );
314 int bucket_size = prof_buckets( bucket );
315 *num_buckets = ( int ) ( llength / 65536 / 2 );
316 blength = ( unsigned long ) ( *num_buckets * bucket_size );
317 return ( blength );
318}
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ event_name

char event_name[PAPI_MAX_STR_LEN]
extern

Definition at line 29 of file data_range.c.

◆ EventSet

int EventSet
extern

Definition at line 31 of file data_range.c.

◆ PAPI_event

int PAPI_event
extern

Definition at line 30 of file data_range.c.

◆ profbuf

void* profbuf[5]
extern

Definition at line 33 of file prof_utils.c.

◆ values

long long** values
extern

Definition at line 29 of file prof_utils.c.