PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
exeinfo.c
Go to the documentation of this file.
1 /*
2 * File: profile.c
3 * CVS: $Id$
4 * Author: Philip Mucci
5 * mucci@cs.utk.edu
6 * Mods: <your name here>
7 * <your email address>
8 */
9 #include <stdlib.h>
10 #include <stdio.h>
11 #include "papi_test.h"
12 
13 int
14 main( int argc, char **argv )
15 {
16  int retval;
17 
18  const PAPI_exe_info_t *exeinfo;
19 
20  tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
21 
22  if ( ( retval =
24  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
25 
26  if ( ( exeinfo = PAPI_get_executable_info( ) ) == NULL )
27  test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", retval );
28 
29  printf( "Path+Program: %s\n", exeinfo->fullname );
30  printf( "Program: %s\n", exeinfo->address_info.name );
31  printf( "Text start: %p, Text end: %p\n", exeinfo->address_info.text_start,
32  exeinfo->address_info.text_end );
33  printf( "Data start: %p, Data end: %p\n", exeinfo->address_info.data_start,
34  exeinfo->address_info.data_end );
35  printf( "Bss start: %p, Bss end: %p\n", exeinfo->address_info.bss_start,
36  exeinfo->address_info.bss_end );
37 
38  if ( ( strlen( &(exeinfo->fullname[0]) ) == 0 ) )
39  test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
40  if ( ( strlen( &(exeinfo->address_info.name[0]) ) == 0 ) )
41  test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
42  if ( ( exeinfo->address_info.text_start == 0x0 ) ||
43  ( exeinfo->address_info.text_end == 0x0 ) ||
44  ( exeinfo->address_info.text_start >=
45  exeinfo->address_info.text_end ) )
46  test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
47  if ( ( exeinfo->address_info.data_start == 0x0 ) ||
48  ( exeinfo->address_info.data_end == 0x0 ) ||
49  ( exeinfo->address_info.data_start >=
50  exeinfo->address_info.data_end ) )
51  test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
52 /*
53  if ((exeinfo->address_info.bss_start == 0x0) || (exeinfo->address_info.bss_end == 0x0) ||
54  (exeinfo->address_info.bss_start >= exeinfo->address_info.bss_end))
55  test_fail(__FILE__, __LINE__, "PAPI_get_executable_info",1);
56 */
57 
58  sleep( 1 ); /* Needed for debugging, so you can ^Z and stop the process, inspect /proc to see if it's right */
59 
60  test_pass( __FILE__, NULL, 0 );
61  exit( 0 );
62 }
char name[PAPI_HUGE_STR_LEN]
Definition: papi.h:693
sleep(1)
caddr_t text_end
Definition: papi.h:695
get the executable&#39;s info
Definition: papi.h:704
caddr_t bss_start
Definition: papi.h:698
tests_quiet(argc, argv)
#define printf
Definition: papi_test.h:125
test_pass(__FILE__, NULL, 0)
int int argc
Definition: iozone.c:1609
char ** argv
Definition: iozone.c:1610
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
int PAPI_library_init(int version)
Definition: papi.c:497
const PAPI_exe_info_t * PAPI_get_executable_info(void)
Definition: papi.c:6040
caddr_t text_start
Definition: papi.h:694
PAPI_address_map_t address_info
Definition: papi.h:706
caddr_t data_start
Definition: papi.h:696
caddr_t bss_end
Definition: papi.h:699
caddr_t data_end
Definition: papi.h:697
char fullname[PAPI_HUGE_STR_LEN]
Definition: papi.h:705
ssize_t retval
Definition: libasync.c:338
#define PAPI_VER_CURRENT
Definition: papi.h:223
int main(int argc, char **argv)
List all appio events codes and names.
void exit()