Getting region date per process in Darwin
This commit is contained in:
parent
888efc1b36
commit
819a661be5
@ -396,6 +396,18 @@ size_t zmalloc_get_smap_bytes_by_field(char *field, long pid) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
size_t zmalloc_get_smap_bytes_by_field(char *field, long pid) {
|
size_t zmalloc_get_smap_bytes_by_field(char *field, long pid) {
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
struct proc_regioninfo pri;
|
||||||
|
if (proc_pidinfo(pid, PROC_PIDREGIONINFO, 0, &pri, PROC_PIDREGIONINFO_SIZE) ==
|
||||||
|
PROC_PIDREGIONINFO_SIZE) {
|
||||||
|
if (!strcmp(field, "Private_Dirty")) {
|
||||||
|
return (size_t)pri.pri_pages_dirtied * 4096;
|
||||||
|
} else if (!strcmp(field, "Rss")) {
|
||||||
|
return (size_t)pri.pri_pages_resident * 4096;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
((void) field);
|
((void) field);
|
||||||
((void) pid);
|
((void) pid);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
|
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include <malloc/malloc.h>
|
#include <malloc/malloc.h>
|
||||||
|
#include <libproc.h>
|
||||||
#define HAVE_MALLOC_SIZE 1
|
#define HAVE_MALLOC_SIZE 1
|
||||||
#define zmalloc_size(p) malloc_size(p)
|
#define zmalloc_size(p) malloc_size(p)
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user