• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

csimmonds/procrank_linux: procrank from Android ported to (embedded) Linux

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

csimmonds/procrank_linux

开源软件地址(OpenSource Url):

https://github.com/csimmonds/procrank_linux

开源编程语言(OpenSource Language):

C 92.9%

开源软件介绍(OpenSource Introduction):

Display true memory usage using procrank

procrank is a tool commonly used by Android platform developers to find out how much memory is really being used. In fact it is so useful that I was surprised to find that versions that run on normal Linux are so conspicuous by their absence. Hence my port to Linux here.

I have tested it so far only on 64-bit x86 and 32-bit ARM, but it should work on any architecture so long as the kernel has pagemap.

Build

For a native build:

$ make

To cross compile:

$ make CROSS_COMPILE=<your cross compile prefix>

Usage

Simply run the program (as root):

./procrank 
  PID       Vss      Rss      Pss      Uss  cmdline
 1109    29072K   16388K   11296K    9600K  /usr/bin/python
  584    65160K   10400K    9372K    9096K  /usr/bin/node
...
                           ------   ------  ------
                           78433K   65556K  TOTAL

RAM: 509016K total, 346780K free, 14616K buffers, 70652K cached,
1468K shmem, 14580K slab

Run "./procranc -h" to see the help screen for more options.

Theory

If you are intereted in the background, I have written a blog post on smaps and Pss at http://2net.co.uk/tutorial/procrank

Where the source files came from

This version is from Android Lollipop, which I chose in order to have support for 64-bit kernels as well as 32-bit.

The source for procrank is from $AOSP/system/extras/procrank

I had to edit procrank.c and add

#include <signal.h>

The source for libpagemap is from $AOSP/system/extras/libpagemap

And the source for strlcpy is from $AOSP/bionic/libc/upstream-openbsd/lib/libc/string/strlcpy.c libpagemap




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap