pmap 总计总是以千字节为单位?

pmap 总计总是以千字节为单位?

Linux 命令“pmap”是否总是给出以千字节为单位的总内存使用量?

$ pmap 3208920 | tail -n 1 
 total            71836K

答案1

总是如此以千字节为单位显示:

            if (sizeof(long) == 8)
                /* Translation Hint: keep total string length
                 * as 24 characters. Adjust %16 if needed*/
                printf(_(" total %16ldK\n"),
                       (total_shared + total_private_writeable +
                    total_private_readonly) >> 10);
            else
                /* Translation Hint: keep total string length
                 * as 16 characters. Adjust %8 if needed*/
                printf(_(" total %8ldK\n"),
                       (total_shared + total_private_writeable +
                    total_private_readonly) >> 10);

(右移 10 相当于除以 1,024。)

相关内容