1138 unsigned long t_index = 0, d_index = 0, b_index = 0, counting = 1;
1141 unsigned long begin = 0, end = 0, size = 0, inode = 0, foo = 0;
1145 memset( fname, 0x0,
sizeof ( fname ) );
1146 memset(
buf, 0x0,
sizeof (
buf ) );
1147 memset( perm, 0x0,
sizeof ( perm ) );
1148 memset( dev, 0x0,
sizeof ( dev ) );
1149 memset( mapname, 0x0,
sizeof ( mapname ) );
1150 memset( lastmapname, 0x0,
sizeof ( lastmapname ) );
1152 sprintf( fname,
"/proc/%ld/maps", (
long ) mdi->
pid );
1153 f = fopen( fname,
"r" );
1156 PAPIERROR(
"fopen(%s) returned < 0", fname );
1161 while ( !feof(
f ) ) {
1162 begin = end = size = inode = foo = 0;
1163 if ( fgets(
buf,
sizeof (
buf ),
f ) == 0 )
1166 if ( strlen( mapname ) )
1167 strcpy( lastmapname, mapname );
1169 lastmapname[0] =
'\0';
1172 sscanf(
buf,
"%lx-%lx %4s %lx %s %ld %s", &
begin, &end, perm, &foo, dev,
1181 if ( ( perm[2] ==
'x' ) && ( perm[0] ==
'r' ) && ( inode != 0 ) ) {
1190 }
else if ( ( perm[0] ==
'r' ) && ( perm[1] ==
'w' ) &&
1195 mapname ) == 0 ) ) {
1201 }
else if ( ( perm[0] ==
'r' ) && ( perm[1] ==
'w' ) &&
1206 lastmapname ) == 0 ) ) {
1213 }
else if ( !counting ) {
1214 if ( ( perm[2] ==
'x' ) && ( perm[0] ==
'r' ) && ( inode != 0 ) ) {
1222 }
else if ( ( perm[0] ==
'r' ) && ( perm[1] ==
'w' ) &&
1227 && ( t_index > 0 ) &&
1228 (
tmp[t_index - 1].data_start == 0 ) ) {
1232 }
else if ( ( perm[0] ==
'r' ) && ( perm[1] ==
'w' ) &&
1234 if ( ( t_index > 0 ) && (
tmp[t_index - 1].bss_start == 0 ) ) {
1250 if (
tmp == NULL ) {
1251 PAPIERROR(
"Error allocating shared library address map" );
PAPI_shlib_info_t shlib_info
PAPI_address_map_t address_info
#define PAPI_HUGE_STR_LEN
get the executable's address space info
void PAPIERROR(char *format,...)
char fullname[PAPI_HUGE_STR_LEN]
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
#define papi_calloc(a, b)