Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
819a661b
Commit
819a661b
authored
Sep 15, 2019
by
David Carlier
Browse files
Getting region date per process in Darwin
parent
888efc1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/zmalloc.c
View file @
819a661b
...
...
@@ -396,6 +396,18 @@ size_t zmalloc_get_smap_bytes_by_field(char *field, long pid) {
}
#else
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
)
pid
);
return
0
;
...
...
src/zmalloc.h
View file @
819a661b
...
...
@@ -57,6 +57,7 @@
#elif defined(__APPLE__)
#include <malloc/malloc.h>
#include <libproc.h>
#define HAVE_MALLOC_SIZE 1
#define zmalloc_size(p) malloc_size(p)
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment