File: linux-bgq-memory.c

package info (click to toggle)
papi 5.7.0+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 9,856 kB
  • sloc: ansic: 93,265; fortran: 3,338; xml: 2,460; makefile: 815; sh: 290
file content (94 lines) | stat: -rw-r--r-- 1,920 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* 
 * File:    linux-bgq-memory.c
 * CVS:     $Id$
 * Author:  Heike Jagode
 *          jagode@eecs.utk.edu
 * Mods:    
 *          
 */



#include "papi.h"
#include "papi_internal.h"
#include "linux-bgq.h"
#ifdef __LINUX__
#include <limits.h>
#endif
#include <stdio.h>

/*
 * Prototypes...
 */
int init_bgq( PAPI_mh_info_t * pMem_Info );

// inline void cpuid(unsigned int *, unsigned int *,unsigned int *,unsigned int *);

/*
 * Get Memory Information
 *
 * Fills in memory information - effectively set to all 0x00's
 */
extern int
_bgq_get_memory_info( PAPI_hw_info_t * pHwInfo, int pCPU_Type )
{
	int retval = 0;

	switch ( pCPU_Type ) {
	default:
		//fprintf(stderr,"Default CPU type in %s (%d)\n",__FUNCTION__,__LINE__);
		retval = init_bgq( &pHwInfo->mem_hierarchy );
		break;
	}

	return retval;
}

/*
 * Get DMem Information for BG/Q
 *
 * NOTE:  Currently, all values set to -1
 */
extern int
_bgq_get_dmem_info( PAPI_dmem_info_t * pDmemInfo )
{
//  pid_t xPID = getpid();
//  prpsinfo_t xInfo;
//  char xFile[256];
//  int xFD;

//  sprintf(xFile, "/proc/%05d", xPID);
//  if ((fd = open(xFile, O_RDONLY)) < 0) {
//     SUBDBG("PAPI_get_dmem_info can't open /proc/%d\n", xPID);
//     return (PAPI_ESYS);
//  }
//  if (ioctl(xFD, PIOCPSINFO, &xInfo) < 0) {
//     return (PAPI_ESYS);
//  }
//  close(xFD);

	pDmemInfo->size = PAPI_EINVAL;
	pDmemInfo->resident = PAPI_EINVAL;
	pDmemInfo->high_water_mark = PAPI_EINVAL;
	pDmemInfo->shared = PAPI_EINVAL;
	pDmemInfo->text = PAPI_EINVAL;
	pDmemInfo->library = PAPI_EINVAL;
	pDmemInfo->heap = PAPI_EINVAL;
	pDmemInfo->locked = PAPI_EINVAL;
	pDmemInfo->stack = PAPI_EINVAL;
	pDmemInfo->pagesize = PAPI_EINVAL;

	return PAPI_OK;
}

/*
 * Cache configuration for BG/Q
 */
int
init_bgq( PAPI_mh_info_t * pMem_Info )
{
	memset( pMem_Info, 0x0, sizeof ( *pMem_Info ) );
	//fprintf(stderr,"mem_info not est up [%s (%d)]\n",__FUNCTION__,__LINE__);

	return PAPI_OK;
}