PAPI  5.0.1.0
exeinfo.c
Go to the documentation of this file.
00001 /* 
00002 * File:    profile.c
00003 * CVS:     $Id$
00004 * Author:  Philip Mucci
00005 *          mucci@cs.utk.edu
00006 * Mods:    <your name here>
00007 *          <your email address>
00008 */
00009 #include <stdlib.h>
00010 #include <stdio.h>
00011 #include "papi_test.h"
00012 
00013 int
00014 main( int argc, char **argv )
00015 {
00016     int retval;
00017 
00018     const PAPI_exe_info_t *exeinfo;
00019 
00020     tests_quiet( argc, argv );  /* Set TESTS_QUIET variable */
00021 
00022     if ( ( retval =
00023            PAPI_library_init( PAPI_VER_CURRENT ) ) != PAPI_VER_CURRENT )
00024         test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
00025 
00026     if ( ( exeinfo = PAPI_get_executable_info(  ) ) == NULL )
00027         test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", retval );
00028 
00029     printf( "Path+Program: %s\n", exeinfo->fullname );
00030     printf( "Program: %s\n", exeinfo->address_info.name );
00031     printf( "Text start: %p, Text end: %p\n", exeinfo->address_info.text_start,
00032             exeinfo->address_info.text_end );
00033     printf( "Data start: %p, Data end: %p\n", exeinfo->address_info.data_start,
00034             exeinfo->address_info.data_end );
00035     printf( "Bss start: %p, Bss end: %p\n", exeinfo->address_info.bss_start,
00036             exeinfo->address_info.bss_end );
00037 
00038     if ( ( strlen( &(exeinfo->fullname[0]) ) == 0 ) )
00039         test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
00040     if ( ( strlen( &(exeinfo->address_info.name[0]) ) == 0 ) )
00041         test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
00042     if ( ( exeinfo->address_info.text_start == 0x0 ) ||
00043          ( exeinfo->address_info.text_end == 0x0 ) ||
00044          ( exeinfo->address_info.text_start >=
00045            exeinfo->address_info.text_end ) )
00046         test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
00047     if ( ( exeinfo->address_info.data_start == 0x0 ) ||
00048          ( exeinfo->address_info.data_end == 0x0 ) ||
00049          ( exeinfo->address_info.data_start >=
00050            exeinfo->address_info.data_end ) )
00051         test_fail( __FILE__, __LINE__, "PAPI_get_executable_info", 1 );
00052 /*
00053    if ((exeinfo->address_info.bss_start == 0x0) || (exeinfo->address_info.bss_end == 0x0) ||
00054        (exeinfo->address_info.bss_start >= exeinfo->address_info.bss_end))
00055      test_fail(__FILE__, __LINE__, "PAPI_get_executable_info",1);
00056 */
00057 
00058     sleep( 1 );              /* Needed for debugging, so you can ^Z and stop the process, inspect /proc to see if it's right */
00059 
00060     test_pass( __FILE__, NULL, 0 );
00061     exit( 0 );
00062 }
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines