PAPI 7.1.0.0
Loading...
Searching...
No Matches
aix-memory.c
Go to the documentation of this file.
1/*
2* File: aix-memory.c
3* Author: Kevin London
4* london@cs.utk.edu
5*
6* Mods: <your name here>
7* <your email address>
8*/
9
10#include "papi.h"
11#include "papi_internal.h"
12
13#include "aix.h"
14
15int
17{
18 PAPI_mh_level_t *L = mem_info->mem_hierarchy.level;
19
20 /* Not quite sure what bit 30 indicates.
21 I'm assuming it flags a unified tlb */
22 if ( _system_configuration.tlb_attrib & ( 1 << 30 ) ) {
24 L[0].tlb[0].num_entries = _system_configuration.itlb_size;
26 } else {
27 L[0].tlb[0].type = PAPI_MH_TYPE_INST;
28 L[0].tlb[0].num_entries = _system_configuration.itlb_size;
29 L[0].tlb[0].associativity = _system_configuration.itlb_asc;
30 L[0].tlb[1].type = PAPI_MH_TYPE_DATA;
31 L[0].tlb[1].num_entries = _system_configuration.dtlb_size;
32 L[0].tlb[1].associativity = _system_configuration.dtlb_asc;
33 }
34 /* Not quite sure what bit 30 indicates.
35 I'm assuming it flags a unified cache */
36 if ( _system_configuration.cache_attrib & ( 1 << 30 ) ) {
38 L[0].cache[0].size = _system_configuration.icache_size;
39 L[0].cache[0].associativity = _system_configuration.icache_asc;
40 L[0].cache[0].line_size = _system_configuration.icache_line;
41 } else {
43 L[0].cache[0].size = _system_configuration.icache_size;
44 L[0].cache[0].associativity = _system_configuration.icache_asc;
45 L[0].cache[0].line_size = _system_configuration.icache_line;
47 L[0].cache[1].size = _system_configuration.dcache_size;
48 L[0].cache[1].associativity = _system_configuration.dcache_asc;
49 L[0].cache[1].line_size = _system_configuration.dcache_line;
50 }
52 L[1].cache[0].size = _system_configuration.L2_cache_size;
53 L[1].cache[0].associativity = _system_configuration.L2_cache_asc;
54 /* is there a line size for Level 2 cache? */
55
56 /* it looks like we've always got at least 2 levels of info */
57 /* what about level 3 cache? */
58 mem_info->mem_hierarchy.levels = 2;
59
60 return PAPI_OK;
61}
62
63int
65{
66 /* This function has been reimplemented
67 to conform to current interface.
68 It has not been tested.
69 Nor has it been confirmed for completeness.
70 dkt 05-10-06
71 */
72
73 struct procsinfo pi;
74 pid_t mypid = getpid( );
75 pid_t pid;
76 int found = 0;
77
78 pid = 0;
79 while ( 1 ) {
80 if ( getprocs( &pi, sizeof ( pi ), 0, 0, &pid, 1 ) != 1 )
81 break;
82 if ( mypid == pi.pi_pid ) {
83 found = 1;
84 break;
85 }
86 }
87 if ( !found )
88 return ( PAPI_ESYS );
89
90 d->size = pi.pi_size;
91 d->resident = pi.pi_drss + pi.pi_trss;
94 d->text = pi.pi_trss; /* this is a guess */
96 d->heap = PAPI_EINVAL;
98 d->stack = PAPI_EINVAL;
99 d->pagesize = getpagesize( );
100
101 return ( PAPI_OK );
102}
int _aix_get_memory_info(PAPI_hw_info_t *mem_info, int type)
Definition: aix-memory.c:16
int _aix_get_dmem_info(PAPI_dmem_info_t *d)
Definition: aix-memory.c:64
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_EINVAL
Definition: f90papi.h:115
#define PAPI_ESYS
Definition: f90papi.h:136
uint16_t type
Return codes and api definitions.
#define PAPI_MH_TYPE_DATA
Definition: papi.h:720
#define PAPI_MH_TYPE_INST
Definition: papi.h:719
#define PAPI_MH_TYPE_UNIFIED
Definition: papi.h:723
static int pid
A pointer to the following is passed to PAPI_get_dmem_info()
Definition: papi.h:865
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
Hardware info structure.
Definition: papi.h:774
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