|
PAPI
5.0.1.0
|
00001 /* 00002 * File: linux-bgq-memory.c 00003 * CVS: $Id$ 00004 * Author: Heike Jagode 00005 * jagode@eecs.utk.edu 00006 * Mods: 00007 * 00008 */ 00009 00010 00011 00012 #include "papi.h" 00013 #include "papi_internal.h" 00014 #include "linux-bgq.h" 00015 #ifdef __LINUX__ 00016 #include <limits.h> 00017 #endif 00018 #include <stdio.h> 00019 00020 /* 00021 * Prototypes... 00022 */ 00023 int init_bgq( PAPI_mh_info_t * pMem_Info ); 00024 00025 // inline void cpuid(unsigned int *, unsigned int *,unsigned int *,unsigned int *); 00026 00027 /* 00028 * Get Memory Information 00029 * 00030 * Fills in memory information - effectively set to all 0x00's 00031 */ 00032 extern int 00033 _bgq_get_memory_info( PAPI_hw_info_t * pHwInfo, int pCPU_Type ) 00034 { 00035 int retval = 0; 00036 00037 switch ( pCPU_Type ) { 00038 default: 00039 //fprintf(stderr,"Default CPU type in %s (%d)\n",__FUNCTION__,__LINE__); 00040 retval = init_bgq( &pHwInfo->mem_hierarchy ); 00041 break; 00042 } 00043 00044 return retval; 00045 } 00046 00047 /* 00048 * Get DMem Information for BG/Q 00049 * 00050 * NOTE: Currently, all values set to -1 00051 */ 00052 extern int 00053 _bgq_get_dmem_info( PAPI_dmem_info_t * pDmemInfo ) 00054 { 00055 // pid_t xPID = getpid(); 00056 // prpsinfo_t xInfo; 00057 // char xFile[256]; 00058 // int xFD; 00059 00060 // sprintf(xFile, "/proc/%05d", xPID); 00061 // if ((fd = open(xFile, O_RDONLY)) < 0) { 00062 // SUBDBG("PAPI_get_dmem_info can't open /proc/%d\n", xPID); 00063 // return (PAPI_ESYS); 00064 // } 00065 // if (ioctl(xFD, PIOCPSINFO, &xInfo) < 0) { 00066 // return (PAPI_ESYS); 00067 // } 00068 // close(xFD); 00069 00070 pDmemInfo->size = PAPI_EINVAL; 00071 pDmemInfo->resident = PAPI_EINVAL; 00072 pDmemInfo->high_water_mark = PAPI_EINVAL; 00073 pDmemInfo->shared = PAPI_EINVAL; 00074 pDmemInfo->text = PAPI_EINVAL; 00075 pDmemInfo->library = PAPI_EINVAL; 00076 pDmemInfo->heap = PAPI_EINVAL; 00077 pDmemInfo->locked = PAPI_EINVAL; 00078 pDmemInfo->stack = PAPI_EINVAL; 00079 pDmemInfo->pagesize = PAPI_EINVAL; 00080 00081 return PAPI_OK; 00082 } 00083 00084 /* 00085 * Cache configuration for BG/Q 00086 */ 00087 int 00088 init_bgq( PAPI_mh_info_t * pMem_Info ) 00089 { 00090 memset( pMem_Info, 0x0, sizeof ( *pMem_Info ) ); 00091 //fprintf(stderr,"mem_info not est up [%s (%d)]\n",__FUNCTION__,__LINE__); 00092 00093 return PAPI_OK; 00094 }