PAPI  5.6.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: exeinfo.c
3 * Author: Philip Mucci
4 * mucci@cs.utk.edu
5 * Mods: <your name here>
6 * <your email address>
7 */
8 
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <unistd.h>
12 #include <string.h>
13 
14 #include "papi.h"
15 #include "papi_test.h"
16 
17 int
18 main( int argc, char **argv )
19 {
20  int retval;
21 
22  const PAPI_exe_info_t *exeinfo;
23 
24  tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
25 
26  if ( ( retval =
28  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
29 
30  if ( ( exeinfo = PAPI_get_executable_info( ) ) == NULL )
31  test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", retval );
32 
33  if (!TESTS_QUIET) {
34  printf( "Path+Program: %s\n", exeinfo->fullname );
35  printf( "Program: %s\n", exeinfo->address_info.name );
36  printf( "Text start: %p, Text end: %p\n", exeinfo->address_info.text_start,
37  exeinfo->address_info.text_end );
38  printf( "Data start: %p, Data end: %p\n", exeinfo->address_info.data_start,
39  exeinfo->address_info.data_end );
40  printf( "Bss start: %p, Bss end: %p\n", exeinfo->address_info.bss_start,
41  exeinfo->address_info.bss_end );
42  }
43 
44  if ( ( strlen( &(exeinfo->fullname[0]) ) == 0 ) )
45  test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
46  if ( ( strlen( &(exeinfo->address_info.name[0]) ) == 0 ) )
47  test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
48  if ( ( exeinfo->address_info.text_start == 0x0 ) ||
49  ( exeinfo->address_info.text_end == 0x0 ) ||
50  ( exeinfo->address_info.text_start >=
51  exeinfo->address_info.text_end ) )
52  test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
53  if ( ( exeinfo->address_info.data_start == 0x0 ) ||
54  ( exeinfo->address_info.data_end == 0x0 ) ||
55  ( exeinfo->address_info.data_start >=
56  exeinfo->address_info.data_end ) )
57  test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
58 /*
59  if ((exeinfo->address_info.bss_start == 0x0) || (exeinfo->address_info.bss_end == 0x0) ||
60  (exeinfo->address_info.bss_start >= exeinfo->address_info.bss_end))
61  test_fail(__FILE__, __LINE__, "PAPI_get_executable_info",1);
62 */
63 
64  sleep( 1 ); /* Needed for debugging, so you can ^Z and stop the process, inspect /proc to see if it's right */
65 
66  test_pass( __FILE__ );
67 
68  return 0;
69 }
char name[PAPI_HUGE_STR_LEN]
Definition: papi.h:696
void test_pass(const char *filename)
Definition: test_utils.c:432
sleep(1)
caddr_t text_end
Definition: papi.h:698
get the executable&#39;s info
Definition: papi.h:707
caddr_t bss_start
Definition: papi.h:701
int int argc
Definition: iozone.c:1609
Return codes and api definitions.
char ** argv
Definition: iozone.c:1610
int PAPI_library_init(int version)
Definition: papi.c:500
const PAPI_exe_info_t * PAPI_get_executable_info(void)
Definition: papi.c:6114
caddr_t text_start
Definition: papi.h:697
PAPI_address_map_t address_info
Definition: papi.h:709
caddr_t data_start
Definition: papi.h:699
printf("\tTry: -i 0 -i 1 \n\n")
int TESTS_QUIET
Definition: test_utils.c:18
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
void test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:468
caddr_t bss_end
Definition: papi.h:702
caddr_t data_end
Definition: papi.h:700
char fullname[PAPI_HUGE_STR_LEN]
Definition: papi.h:708
ssize_t retval
Definition: libasync.c:338
#define PAPI_VER_CURRENT
Definition: papi.h:225
int main(int argc, char **argv)
List all appio events codes and names.