Giter VIP home page Giter VIP logo

procrank_linux's 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

procrank_linux's People

Contributors

csimmonds avatar gustavoz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.