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
5a8a0050
Commit
5a8a0050
authored
Sep 20, 2019
by
David Carlier
Browse files
Adding AnonHugePages case + comments
parent
819a661b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/zmalloc.c
View file @
5a8a0050
...
@@ -395,15 +395,24 @@ size_t zmalloc_get_smap_bytes_by_field(char *field, long pid) {
...
@@ -395,15 +395,24 @@ size_t zmalloc_get_smap_bytes_by_field(char *field, long pid) {
return
bytes
;
return
bytes
;
}
}
#else
#else
/* Get sum of the specified field from libproc api call.
* As there are per page value basis we need to convert
* them accordingly.
*
* Note that AnonHugePages is a no-op as THP feature
* is not supported in this platform
*/
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__)
#if defined(__APPLE__)
struct
proc_regioninfo
pri
;
struct
proc_regioninfo
pri
;
if
(
proc_pidinfo
(
pid
,
PROC_PIDREGIONINFO
,
0
,
&
pri
,
PROC_PIDREGIONINFO_SIZE
)
==
if
(
proc_pidinfo
(
pid
,
PROC_PIDREGIONINFO
,
0
,
&
pri
,
PROC_PIDREGIONINFO_SIZE
)
==
PROC_PIDREGIONINFO_SIZE
)
{
PROC_PIDREGIONINFO_SIZE
)
{
if
(
!
strcmp
(
field
,
"Private_Dirty"
))
{
if
(
!
strcmp
(
field
,
"Private_Dirty
:
"
))
{
return
(
size_t
)
pri
.
pri_pages_dirtied
*
4096
;
return
(
size_t
)
pri
.
pri_pages_dirtied
*
4096
;
}
else
if
(
!
strcmp
(
field
,
"Rss"
))
{
}
else
if
(
!
strcmp
(
field
,
"Rss
:
"
))
{
return
(
size_t
)
pri
.
pri_pages_resident
*
4096
;
return
(
size_t
)
pri
.
pri_pages_resident
*
4096
;
}
else
if
(
!
strcmp
(
field
,
"AnonHugePages:"
))
{
return
0
;
}
}
}
}
return
0
;
return
0
;
...
...
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