solaris-memory.c File Reference

Include dependency graph for solaris-memory.c:

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

int _niagara2_get_memory_info ( PAPI_hw_info_t hw,
int  id 
)

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

00148 {
00149     PAPI_mh_level_t *mem = hw->mem_hierarchy.level;
00150 
00151 
00152     /* I-Cache -> L1$ instruction */
00153     /* FIXME: The policy used at this cache is unknown to PAPI. LSFR with random
00154        replacement. */
00155     mem[0].cache[0].type = PAPI_MH_TYPE_INST;
00156     mem[0].cache[0].size = 16 * 1024;   // 16 Kb
00157     mem[0].cache[0].line_size = 32;
00158     mem[0].cache[0].num_lines =
00159         mem[0].cache[0].size / mem[0].cache[0].line_size;
00160     mem[0].cache[0].associativity = 8;
00161 
00162     /* D-Cache -> L1$ data */
00163     mem[0].cache[1].type =
00164         PAPI_MH_TYPE_DATA | PAPI_MH_TYPE_WT | PAPI_MH_TYPE_LRU;
00165     mem[0].cache[1].size = 8 * 1024;    // 8 Kb
00166     mem[0].cache[1].line_size = 16;
00167     mem[0].cache[1].num_lines =
00168         mem[0].cache[1].size / mem[0].cache[1].line_size;
00169     mem[0].cache[1].associativity = 4;
00170 
00171     /* ITLB -> TLB instruction */
00172     mem[0].tlb[0].type = PAPI_MH_TYPE_INST | PAPI_MH_TYPE_PSEUDO_LRU;
00173     mem[0].tlb[0].num_entries = 64;
00174     mem[0].tlb[0].associativity = 64;
00175 
00176     /* DTLB -> TLB data */
00177     mem[0].tlb[1].type = PAPI_MH_TYPE_DATA | PAPI_MH_TYPE_PSEUDO_LRU;
00178     mem[0].tlb[1].num_entries = 128;
00179     mem[0].tlb[1].associativity = 128;
00180 
00181     /* L2$ unified */
00182     mem[1].cache[0].type = PAPI_MH_TYPE_UNIFIED | PAPI_MH_TYPE_WB
00183         | PAPI_MH_TYPE_PSEUDO_LRU;
00184     mem[1].cache[0].size = 4 * 1024 * 1024; // 4 Mb
00185     mem[1].cache[0].line_size = 64;
00186     mem[1].cache[0].num_lines =
00187         mem[1].cache[0].size / mem[1].cache[0].line_size;
00188     mem[1].cache[0].associativity = 16;
00189 
00190     /* Indicate we have two levels filled in the hierarchy */
00191     hw->mem_hierarchy.levels = 2;
00192 
00193     return PAPI_OK;
00194 }

int _solaris_get_dmem_info ( PAPI_dmem_info_t d  ) 

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

00118 {
00119 
00120     FILE *fd;
00121     struct psinfo psi;
00122 
00123     if ( ( fd = fopen( "/proc/self/psinfo", "r" ) ) == NULL ) {
00124         SUBDBG( "fopen(/proc/self) errno %d", errno );
00125         return ( PAPI_ESYS );
00126     }
00127 
00128     fread( ( void * ) &psi, sizeof ( struct psinfo ), 1, fd );
00129     fclose( fd );
00130 
00131     d->pagesize = sysconf( _SC_PAGESIZE );
00132     d->size = d->pagesize * sysconf( _SC_PHYS_PAGES );
00133     d->resident = ( ( 1024 * psi.pr_size ) / d->pagesize );
00134     d->high_water_mark = PAPI_EINVAL;
00135     d->shared = PAPI_EINVAL;
00136     d->text = PAPI_EINVAL;
00137     d->library = PAPI_EINVAL;
00138     d->heap = PAPI_EINVAL;
00139     d->locked = PAPI_EINVAL;
00140     d->stack = PAPI_EINVAL;
00141 
00142     return PAPI_OK;
00143 
00144 }

Here is the call graph for this function:

int _solaris_get_memory_info ( PAPI_hw_info_t hw,
int  id 
)

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

00022 {
00023         FILE *pipe;
00024         char line[BUFSIZ];
00025 
00026     PAPI_mh_level_t *mem = hw->mem_hierarchy.level;
00027 
00028     pipe=popen("prtconf -pv","r");
00029         if (pipe==NULL) {
00030        return PAPI_ESYS;
00031     }
00032 
00033     while(1) {
00034 
00035        if (fgets(line,BUFSIZ,pipe)==NULL) break;
00036 
00037            if (strstr(line,"icache-size:")) {
00038           sscanf(line,"%*s %#x",&mem[0].cache[0].size);
00039        }
00040            if (strstr(line,"icache-line-size:")) {
00041           sscanf(line,"%*s %#x",&mem[0].cache[0].line_size);
00042        }
00043            if (strstr(line,"icache-associativity:")) {
00044           sscanf(line,"%*s %#x",&mem[0].cache[0].associativity);
00045        }
00046 
00047            if (strstr(line,"dcache-size:")) {
00048           sscanf(line,"%*s %#x",&mem[0].cache[1].size);
00049        }
00050            if (strstr(line,"dcache-line-size:")) {
00051           sscanf(line,"%*s %#x",&mem[0].cache[1].line_size);
00052        }
00053            if (strstr(line,"dcache-associativity:")) {
00054           sscanf(line,"%*s %#x",&mem[0].cache[1].associativity);
00055        }
00056 
00057            if (strstr(line,"ecache-size:")) {
00058           sscanf(line,"%*s %#x",&mem[1].cache[0].size);
00059        }
00060            if (strstr(line,"ecache-line-size:")) {
00061           sscanf(line,"%*s %#x",&mem[1].cache[0].line_size);
00062        }
00063            if (strstr(line,"ecache-associativity:")) {
00064           sscanf(line,"%*s %#x",&mem[1].cache[0].associativity);
00065        }
00066 
00067            if (strstr(line,"#itlb-entries:")) {
00068           sscanf(line,"%*s %#x",&mem[0].tlb[0].num_entries);
00069        }
00070            if (strstr(line,"#dtlb-entries:")) {
00071           sscanf(line,"%*s %#x",&mem[0].tlb[1].num_entries);
00072        }
00073 
00074     }
00075        
00076 
00077         pclose(pipe);
00078 
00079     /* I-Cache -> L1$ instruction */
00080     mem[0].cache[0].type = PAPI_MH_TYPE_INST;
00081     if (mem[0].cache[0].line_size!=0) mem[0].cache[0].num_lines =
00082         mem[0].cache[0].size / mem[0].cache[0].line_size;
00083 
00084     /* D-Cache -> L1$ data */
00085     mem[0].cache[1].type =
00086         PAPI_MH_TYPE_DATA | PAPI_MH_TYPE_WT | PAPI_MH_TYPE_LRU;
00087     if (mem[0].cache[1].line_size!=0) mem[0].cache[1].num_lines =
00088         mem[0].cache[1].size / mem[0].cache[1].line_size;
00089 
00090 
00091     /* ITLB -> TLB instruction */
00092     mem[0].tlb[0].type = PAPI_MH_TYPE_INST | PAPI_MH_TYPE_PSEUDO_LRU;
00093         /* assume fully associative */
00094     mem[0].tlb[0].associativity = mem[0].tlb[0].num_entries;
00095 
00096     /* DTLB -> TLB data */
00097     mem[0].tlb[1].type = PAPI_MH_TYPE_DATA | PAPI_MH_TYPE_PSEUDO_LRU;
00098         /* assume fully associative */
00099     mem[0].tlb[1].associativity = mem[0].tlb[1].num_entries;
00100 
00101     /* L2$ unified */
00102     mem[1].cache[0].type = PAPI_MH_TYPE_UNIFIED | PAPI_MH_TYPE_WB
00103         | PAPI_MH_TYPE_PSEUDO_LRU;
00104     if (mem[1].cache[0].line_size!=0) mem[1].cache[0].num_lines =
00105         mem[1].cache[0].size / mem[1].cache[0].line_size;
00106 
00107     /* Indicate we have two levels filled in the hierarchy */
00108     hw->mem_hierarchy.levels = 2;
00109 
00110     return PAPI_OK;
00111 }


Generated on 26 Jan 2016 for PAPI by  doxygen 1.6.1