PAPI 7.1.0.0
Loading...
Searching...
No Matches
darwin-memory.c
Go to the documentation of this file.
1#include <string.h>
2#include <errno.h>
3
4#include "papi.h"
5#include "papi_internal.h"
6#include "papi_memory.h" /* papi_calloc() */
7
8#include "x86_cpuid_info.h"
9
10#include "darwin-lock.h"
11
12int
14{
15
16 int mib[4];
17 size_t len;
18 char buffer[BUFSIZ];
19 long long ll;
20
21 /**********/
22 /* memory */
23 /**********/
24 len = 2;
25 sysctlnametomib("hw.memsize", mib, &len);
26
27 len = 8;
28 if (sysctl(mib, 2, &ll, &len, NULL, 0) == -1) {
29 return PAPI_ESYS;
30 }
31
32 d->size=ll;
33
34 d->pagesize = getpagesize( );
35
36 return PAPI_OK;
37}
38
39/*
40 * Architecture-specific cache detection code
41 */
42
43
44#if defined(__i386__)||defined(__x86_64__)
45static int
46x86_get_memory_info( PAPI_hw_info_t * hw_info )
47{
48 int retval = PAPI_OK;
49
50 switch ( hw_info->vendor ) {
51 case PAPI_VENDOR_AMD:
54 break;
55 default:
56 PAPIERROR( "Unknown vendor in memory information call for x86." );
57 return PAPI_ENOIMPL;
58 }
59 return retval;
60}
61#endif
62
63
64int
65_darwin_get_memory_info( PAPI_hw_info_t * hwinfo, int cpu_type )
66{
67 ( void ) cpu_type; /*unused */
68 int retval = PAPI_OK;
69
70 x86_get_memory_info( hwinfo );
71
72 return retval;
73}
74
75int
77{
78
79
80 return PAPI_OK;
81}
static const PAPI_hw_info_t * hw_info
Definition: byte_profile.c:28
int _darwin_update_shlib_info(papi_mdi_t *mdi)
Definition: darwin-memory.c:76
int _darwin_get_dmem_info(PAPI_dmem_info_t *d)
Definition: darwin-memory.c:13
int _darwin_get_memory_info(PAPI_hw_info_t *hwinfo, int cpu_type)
Definition: darwin-memory.c:65
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_VENDOR_INTEL
Definition: f90papi.h:275
#define PAPI_VENDOR_AMD
Definition: f90papi.h:230
#define PAPI_ESYS
Definition: f90papi.h:136
#define PAPI_ENOIMPL
Definition: f90papi.h:219
Return codes and api definitions.
void PAPIERROR(char *format,...)
A pointer to the following is passed to PAPI_get_dmem_info()
Definition: papi.h:865
long long size
Definition: papi.h:867
long long pagesize
Definition: papi.h:876
Hardware info structure.
Definition: papi.h:774
PAPI_mh_info_t mem_hierarchy
Definition: papi.h:793
int vendor
Definition: papi.h:781
int _x86_cache_info(PAPI_mh_info_t *mh_info)
int retval
Definition: zero_fork.c:53