37main(
int argc,
char **argv )
48 fprintf(
stderr,
"Error! PAPI_library_init\n");
53 if (meminfo == NULL ) {
54 fprintf(
stderr,
"Error! PAPI_get_hardware_info");
58 printf(
"Memory Cache and TLB Hierarchy Information.\n" );
59 printf(
"------------------------------------------------------------------------\n" );
63 printf(
"TLB Information.\n There may be multiple descriptors for each level of TLB\n" );
64 printf(
" if multiple page sizes are supported.\n\n" );
70 printf(
"L%d Unified TLB:\n",
i + 1 );
73 printf(
"L%d Data TLB:\n",
i + 1 );
76 printf(
"L%d Instruction TLB:\n",
i + 1 );
79 if ( L[
i].tlb[j].
type ) {
80 if ( L[
i].tlb[j].page_size )
81 printf(
" Page Size: %6d KB\n",
82 L[
i].tlb[j].page_size >> 10 );
83 printf(
" Number of Entries: %6d\n",
84 L[
i].tlb[j].num_entries );
85 switch ( L[
i].tlb[j].associativity ) {
89 printf(
" Associativity: Direct Mapped\n\n" );
92 printf(
" Associativity: Full\n\n" );
95 printf(
" Associativity: %6d\n\n",
96 L[
i].tlb[j].associativity );
104 printf(
"\nCache Information.\n\n" );
106 for ( j = 0; j < 2; j++ ) {
109 printf(
"L%d Unified Cache:\n",
i + 1 );
112 printf(
"L%d Data Cache:\n",
i + 1 );
115 printf(
"L%d Instruction Cache:\n",
i + 1 );
118 printf(
"L%d Trace Buffer:\n",
i + 1 );
121 printf(
"L%d Vector Cache:\n",
i + 1 );
124 if ( L[
i].cache[j].
type ) {
125 printf(
" Total size: %6d KB\n Line size: %6d B\n Number of Lines: %6d\n Associativity: %6d\n\n",
126 ( L[
i].cache[j].size ) >> 10, L[
i].cache[j].line_size,
127 L[
i].cache[j].num_lines,
128 L[
i].cache[j].associativity );
get information about the system hardware
initialize the PAPI library.
Return codes and api definitions.
#define PAPI_MH_TYPE_DATA
#define PAPI_MH_MAX_LEVELS
#define PAPI_MH_CACHE_TYPE(a)
#define PAPI_MH_TYPE_INST
#define PAPI_MH_TYPE_VECTOR
#define PAPI_MH_TYPE_TRACE
#define PAPI_MH_TYPE_UNIFIED
PAPI_mh_info_t mem_hierarchy
PAPI_mh_level_t level[PAPI_MAX_MEM_HIERARCHY_LEVELS]