Solaris based system rss size report. (#8138)
This commit is contained in:
parent
e288430c05
commit
ec951cdc15
@ -87,6 +87,7 @@
|
|||||||
#include <sys/feature_tests.h>
|
#include <sys/feature_tests.h>
|
||||||
#ifdef _DTRACE_VERSION
|
#ifdef _DTRACE_VERSION
|
||||||
#define HAVE_EVPORT 1
|
#define HAVE_EVPORT 1
|
||||||
|
#define HAVE_PSINFO 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -433,6 +433,27 @@ size_t zmalloc_get_rss(void) {
|
|||||||
|
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
#elif defined(HAVE_PSINFO)
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/procfs.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
size_t zmalloc_get_rss(void) {
|
||||||
|
struct prpsinfo info;
|
||||||
|
char filename[256];
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
snprintf(filename,256,"/proc/%d/psinfo",getpid());
|
||||||
|
|
||||||
|
if ((fd = open(filename,O_RDONLY)) == -1) return 0;
|
||||||
|
if (ioctl(fd, PIOCPSINFO, &info) == -1) {
|
||||||
|
close(fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
return info.pr_rssize;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
size_t zmalloc_get_rss(void) {
|
size_t zmalloc_get_rss(void) {
|
||||||
/* If we can't get the RSS in an OS-specific way for this system just
|
/* If we can't get the RSS in an OS-specific way for this system just
|
||||||
|
Loading…
x
Reference in New Issue
Block a user