在redis源码中,我找到了"Rss信息“,但我不知道这是什么。
如果我使用带有查询字符串"file rss information“的Google搜索,我得到的唯一结果是"RSS xml feed”。
这在源代码中定义:
size_t zmalloc_get_rss(void) {
int page = sysconf(_SC_PAGESIZE);
size_t rss;
char buf[4096];
char filename[256];
int fd, count;
char *p, *x;
snprintf(filename,256,"/proc/%d/stat",getpid());
if ((fd = open(filename,O_RDONLY)) == -1) return 0;
if (read(fd,buf,4096) <= 0) {
close(fd);
return 0;
}
close(fd);
p = buf;
count = 23; /* RSS is the 24th field in /proc/<pid>/stat */
while(p && count--) {
p = strchr(p,' ');
if (p) p++;
}
if (!p) return 0;
x = strchr(p,' ');
if (!x) return 0;
*x = '\0';
rss = strtoll(p,NULL,10);
rss *= page;
return rss;
}这会获得进程内存吗?我只能猜测。
发布于 2012-09-03 23:24:19
是的,RSS的意思是“常驻集大小”。
请参阅proc's manual page
驻留集大小:进程在实际内存中的页数。这只是计入文本、数据或堆栈空间的页面。这不包括未按需加载或换出的页面。
https://stackoverflow.com/questions/12250534
复制相似问题