2012-09-03 38 views
1

在我發現「的RSS信息」 Redis的來源,但我不知道這是什麼。什麼是RSS信息?不是RSS XML飼料

如果我使用谷歌搜索與查詢字符串「文件RSS信息」,唯一的結果我得到的是像「RSS XML源」。

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; 
} 

這是否會得到進程的內存:

這是在源代碼中定義?我只能猜測。

回答

1

是,RSS的意思是 「駐留集大小」。

proc's manual page

駐留集大小:號碼的過程中有實內存的頁面。這只是計入文本,數據或堆棧空間的頁面。這不包括未被需求加載或已被換出的頁面。

+0

非常感謝信息much.this是非常重要的。 – SamPeng