1PAPI_get_executable_info(3) PAPI PAPI_get_executable_info(3)
2
3
4
6 PAPI_get_executable_info - get the executable's address space info
7
8
10 C Interface
11 #include <papi.h>
12 const PAPI_exe_info_t *PAPI_get_executable_info(void);
13 Fortran Interface
14 #include fpapi.h
15 PAPIF_get_exe_info(C_STRING fullname,"C_STRING name,
16 C_LONG_LONG text_start, C_LONG_LONG text_end,
17 C_LONG_LONG data_start, C_LONG_LONG data_end,
18 C_LONG_LONG bss_start, C_LONG_LONG bss_end, C_INT check)
19
20
22 In C, this function returns a pointer to a structure containing infor‐
23 mation about the current program. In Fortran, the fields of the struc‐
24 ture are returned explicitly.
25
26
28 The following arguments are implicit in the structure returned by the C
29 function, or explicitly returned by Fortran.
30
31 fullname -- fully qualified path + filename of the executable
32
33 name -- filename of the executable with no path information
34
35 text_start, text_end -- Start and End addresses of program text seg‐
36 ment
37
38 data_start, data_end -- Start and End addresses of program data seg‐
39 ment
40
41 bss_start, bss_end -- Start and End addresses of program bss segment
42
43
45 On success, the C function returns a non-NULL pointer, and the Fortran
46 function returns PAPI_OK.
47 On error, NULL is returned by the C function, and a non-zero error
48 code is returned by the Fortran function.
49
50
52 PAPI_EINVAL
53 One or more of the arguments is invalid.
54
55
57 const PAPI_exe_info_t *prginfo = NULL;
58
59 if ((prginfo = PAPI_get_executable_info()) == NULL)
60 exit(1);
61
62 printf("Path+Program: %s0,exeinfo->fullname);
63 printf("Program: %s0,exeinfo->address_info.name);
64 printf("Text start: %p, Text end: %p0,exeinfo->address_info.text_start,exeinfo->address_info.text_end);
65 printf("Data start: %p, Data end: %p0,exeinfo->address_info.data_start,exeinfo->address_info.data_end);
66 printf("Bss start: %p, Bss end: %p0,exeinfo->address_info.bss_start,exeinfo->address_info.bss_end);
67
68
70 typedef struct _papi_address_map {
71 char name[PAPI_HUGE_STR_LEN];
72 caddr_t text_start; /* Start address of program text segment */
73 caddr_t text_end; /* End address of program text segment */
74 caddr_t data_start; /* Start address of program data segment */
75 caddr_t data_end; /* End address of program data segment */
76 caddr_t bss_start; /* Start address of program bss segment */
77 caddr_t bss_end; /* End address of program bss segment */
78 } PAPI_address_map_t;
79
80 typedef struct _papi_program_info {
81 char fullname[PAPI_HUGE_STR_LEN]; /* path+name */
82 PAPI_address_map_t address_info;
83 } PAPI_exe_info_t;
84
85
87 Only the text_start and text_end fields are filled on every architec‐
88 ture.
89
90
92 PAPI_get_hardware_info(3), PAPI_get_opt(3)
93
94
95
96PAPI Programmer's Reference September, 2004 PAPI_get_executable_info(3)