PAPI 7.1.0.0
Loading...
Searching...
No Matches
solaris-memory.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int _solaris_get_memory_info (PAPI_hw_info_t *hw, int id)
 
int _solaris_get_dmem_info (PAPI_dmem_info_t *d)
 
int _niagara2_get_memory_info (PAPI_hw_info_t *hw, int id)
 

Function Documentation

◆ _niagara2_get_memory_info()

int _niagara2_get_memory_info ( PAPI_hw_info_t hw,
int  id 
)

Definition at line 147 of file solaris-memory.c.

148{
150
151
152 /* I-Cache -> L1$ instruction */
153 /* FIXME: The policy used at this cache is unknown to PAPI. LSFR with random
154 replacement. */
155 mem[0].cache[0].type = PAPI_MH_TYPE_INST;
156 mem[0].cache[0].size = 16 * 1024; // 16 Kb
157 mem[0].cache[0].line_size = 32;
158 mem[0].cache[0].num_lines =
159 mem[0].cache[0].size / mem[0].cache[0].line_size;
160 mem[0].cache[0].associativity = 8;
161
162 /* D-Cache -> L1$ data */
163 mem[0].cache[1].type =
165 mem[0].cache[1].size = 8 * 1024; // 8 Kb
166 mem[0].cache[1].line_size = 16;
167 mem[0].cache[1].num_lines =
168 mem[0].cache[1].size / mem[0].cache[1].line_size;
169 mem[0].cache[1].associativity = 4;
170
171 /* ITLB -> TLB instruction */
173 mem[0].tlb[0].num_entries = 64;
174 mem[0].tlb[0].associativity = 64;
175
176 /* DTLB -> TLB data */
178 mem[0].tlb[1].num_entries = 128;
179 mem[0].tlb[1].associativity = 128;
180
181 /* L2$ unified */
184 mem[1].cache[0].size = 4 * 1024 * 1024; // 4 Mb
185 mem[1].cache[0].line_size = 64;
186 mem[1].cache[0].num_lines =
187 mem[1].cache[0].size / mem[1].cache[0].line_size;
188 mem[1].cache[0].associativity = 16;
189
190 /* Indicate we have two levels filled in the hierarchy */
191 hw->mem_hierarchy.levels = 2;
192
193 return PAPI_OK;
194}
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_MH_TYPE_DATA
Definition: papi.h:720
#define PAPI_MH_TYPE_LRU
Definition: papi.h:729
#define PAPI_MH_TYPE_PSEUDO_LRU
Definition: papi.h:730
#define PAPI_MH_TYPE_WB
Definition: papi.h:726
#define PAPI_MH_TYPE_WT
Definition: papi.h:725
#define PAPI_MH_TYPE_INST
Definition: papi.h:719
#define PAPI_MH_TYPE_UNIFIED
Definition: papi.h:723
PAPI_mh_info_t mem_hierarchy
Definition: papi.h:793
int levels
Definition: papi.h:768
PAPI_mh_level_t level[PAPI_MAX_MEM_HIERARCHY_LEVELS]
Definition: papi.h:769
PAPI_mh_tlb_info_t tlb[PAPI_MH_MAX_LEVELS]
Definition: papi.h:761
PAPI_mh_cache_info_t cache[PAPI_MH_MAX_LEVELS]
Definition: papi.h:762
int associativity
Definition: papi.h:747

◆ _solaris_get_dmem_info()

int _solaris_get_dmem_info ( PAPI_dmem_info_t d)

Definition at line 117 of file solaris-memory.c.

118{
119
120 FILE *fd;
121 struct psinfo psi;
122
123 if ( ( fd = fopen( "/proc/self/psinfo", "r" ) ) == NULL ) {
124 SUBDBG( "fopen(/proc/self) errno %d", errno );
125 return ( PAPI_ESYS );
126 }
127
128 fread( ( void * ) &psi, sizeof ( struct psinfo ), 1, fd );
129 fclose( fd );
130
131 d->pagesize = sysconf( _SC_PAGESIZE );
132 d->size = d->pagesize * sysconf( _SC_PHYS_PAGES );
133 d->resident = ( ( 1024 * psi.pr_size ) / d->pagesize );
135 d->shared = PAPI_EINVAL;
136 d->text = PAPI_EINVAL;
137 d->library = PAPI_EINVAL;
138 d->heap = PAPI_EINVAL;
139 d->locked = PAPI_EINVAL;
140 d->stack = PAPI_EINVAL;
141
142 return PAPI_OK;
143
144}
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
Definition: appio.c:279
int errno
#define PAPI_EINVAL
Definition: f90papi.h:115
#define PAPI_ESYS
Definition: f90papi.h:136
#define SUBDBG(format, args...)
Definition: papi_debug.h:64
int fclose(FILE *__stream)
long long locked
Definition: papi.h:874
long long shared
Definition: papi.h:870
long long text
Definition: papi.h:871
long long heap
Definition: papi.h:873
long long size
Definition: papi.h:867
long long library
Definition: papi.h:872
long long stack
Definition: papi.h:875
long long pagesize
Definition: papi.h:876
long long high_water_mark
Definition: papi.h:869
long long resident
Definition: papi.h:868
Here is the call graph for this function:

◆ _solaris_get_memory_info()

int _solaris_get_memory_info ( PAPI_hw_info_t hw,
int  id 
)

Definition at line 21 of file solaris-memory.c.

22{
23 FILE *pipe;
24 char line[BUFSIZ];
25
27
28 pipe=popen("prtconf -pv","r");
29 if (pipe==NULL) {
30 return PAPI_ESYS;
31 }
32
33 while(1) {
34
35 if (fgets(line,BUFSIZ,pipe)==NULL) break;
36
37 if (strstr(line,"icache-size:")) {
38 sscanf(line,"%*s %#x",&mem[0].cache[0].size);
39 }
40 if (strstr(line,"icache-line-size:")) {
41 sscanf(line,"%*s %#x",&mem[0].cache[0].line_size);
42 }
43 if (strstr(line,"icache-associativity:")) {
44 sscanf(line,"%*s %#x",&mem[0].cache[0].associativity);
45 }
46
47 if (strstr(line,"dcache-size:")) {
48 sscanf(line,"%*s %#x",&mem[0].cache[1].size);
49 }
50 if (strstr(line,"dcache-line-size:")) {
51 sscanf(line,"%*s %#x",&mem[0].cache[1].line_size);
52 }
53 if (strstr(line,"dcache-associativity:")) {
54 sscanf(line,"%*s %#x",&mem[0].cache[1].associativity);
55 }
56
57 if (strstr(line,"ecache-size:")) {
58 sscanf(line,"%*s %#x",&mem[1].cache[0].size);
59 }
60 if (strstr(line,"ecache-line-size:")) {
61 sscanf(line,"%*s %#x",&mem[1].cache[0].line_size);
62 }
63 if (strstr(line,"ecache-associativity:")) {
64 sscanf(line,"%*s %#x",&mem[1].cache[0].associativity);
65 }
66
67 if (strstr(line,"#itlb-entries:")) {
68 sscanf(line,"%*s %#x",&mem[0].tlb[0].num_entries);
69 }
70 if (strstr(line,"#dtlb-entries:")) {
71 sscanf(line,"%*s %#x",&mem[0].tlb[1].num_entries);
72 }
73
74 }
75
76
77 pclose(pipe);
78
79 /* I-Cache -> L1$ instruction */
80 mem[0].cache[0].type = PAPI_MH_TYPE_INST;
81 if (mem[0].cache[0].line_size!=0) mem[0].cache[0].num_lines =
82 mem[0].cache[0].size / mem[0].cache[0].line_size;
83
84 /* D-Cache -> L1$ data */
85 mem[0].cache[1].type =
87 if (mem[0].cache[1].line_size!=0) mem[0].cache[1].num_lines =
88 mem[0].cache[1].size / mem[0].cache[1].line_size;
89
90
91 /* ITLB -> TLB instruction */
93 /* assume fully associative */
94 mem[0].tlb[0].associativity = mem[0].tlb[0].num_entries;
95
96 /* DTLB -> TLB data */
98 /* assume fully associative */
99 mem[0].tlb[1].associativity = mem[0].tlb[1].num_entries;
100
101 /* L2$ unified */
104 if (mem[1].cache[0].line_size!=0) mem[1].cache[0].num_lines =
105 mem[1].cache[0].size / mem[1].cache[0].line_size;
106
107 /* Indicate we have two levels filled in the hierarchy */
108 hw->mem_hierarchy.levels = 2;
109
110 return PAPI_OK;
111}