Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A more indepth explaniton of procstats for Android

I am doing some memory testing and I came across procstats in my research - before I start using it though I would like to fully understand everything before I start relying on its data.

Here is a condensed file of what I am trying to work with:

CURRENT STATS:
* com.samsung.android.providers.context / u0a6:
       TOTAL: 100% (4.2MB-4.2MB-4.2MB/3.3MB-3.3MB-3.3MB over 1)
       Service: 100% (4.2MB-4.2MB-4.2MB/3.3MB-3.3MB-3.3MB over 1)
* com.sec.android.inputmethod / 1000:
       TOTAL: 100% (28MB-28MB-28MB/27MB-27MB-27MB over 2)
      Imp Fg: 100% (28MB-28MB-28MB/27MB-27MB-27MB over 2)
* com.google.android.googlequicksearchbox / u0a54:
       TOTAL: 0.05%
       Imp Bg: 0.05%
      (Cached): 100% (4.8MB-4.9MB-5.0MB/3.2MB-3.3MB-3.4MB over 2)
* com.google.android.talk / u0a98:
       TOTAL: 0.03%
       Imp Bg: 0.03%
       Receiver: 0.00%
       (Cached): 100% (8.8MB-8.8MB-8.8MB/7.4MB-7.4MB-7.4MB over 2)
      (Home): 100% (20MB-20MB-20MB/18MB-18MB-18MB over 1)
Run time Stats:

SOff/Norm: +24m36s393ms (running)
 TOTAL: +24m36s393ms
      Start time: 2014-12-08 14:22:50
      Total elapsed time: +24m36s508ms (partial) libdvm.so chromeview

Here are the questions:

  1. What does "over 1" / "over 2" mean?
  2. What is the difference between Service, Imp Bg, Receiver, and Imp Fg?
  3. Why doesn't every total list the RAM usage (com.google.android.talk for example)
  4. What does 100% mean and what does .03% mean?
  5. Why do only some have (Cached)/(Home)?
  6. What does 100% (Cached)/(Home) mean?
  7. What does "(partial) libdvm.so chromeview" mean?
  8. Lastly, am I correct in assuming that (4.8MB-4.9MB-5.0MB/3.2MB-3.3MB-3.4MB) is (low pss - avg pss - high pss / low uss - avg uss - high uss)?

If anyone could shed any light on this is would be greatly appreciated. Thanks.

As a heads up, I've already read these two links.... android-developers.blogspot.com/2014/01/ and android.googlesource.com/platform/frameworks/base/+/master/core/ .... and a few other pages - these are still the questions that I have left over. Can anyone go into detail about all 8 questions?

Edit

So I have been trying to compare numbers between procstats and meminfo and it really only adds more questions.

Here is an excerpt from procstats

CURRENT STATS:
  * com.dropbox.android:crash_uploader / u0a87:
     TOTAL: 100% (4.8MB-4.8MB-4.9MB/3.9MB-3.9MB-3.9MB over 6)
     Service: 100% (4.8MB-4.8MB-4.9MB/3.9MB-3.9MB-3.9MB over 6)
  * com.mobileposse.client / u0a22:
     TOTAL: 0.16%
     Service: 0.13%
    Receiver: 0.03%
    (Cached): 98% (7.2MB-8.4MB-9.3MB/6.1MB-7.2MB-8.1MB over 7)
  * com.android.chrome / u0a79:
     TOTAL: 0.01%
    Receiver: 0.01%
    (Cached): 86% (5.2MB-5.2MB-5.4MB/4.4MB-4.4MB-4.4MB over 3)

Here is an excerpt from meminfo

Total PSS by process:
 5524 kB: com.android.chrome (pid 7334)
 4969 kB: com.dropbox.android:crash_uploader (pid 5617)

Now dropbox makes sense, and I would say 80% of the processes follow dropbox's lead with having matching numbers between meminfo and pocstats. What I don't get - why does chrome not have any totals in the procstats but is listed in the meminfo and why does mobileposse have higher stats than chrome in the procstats but is not listed in the meminfo?

like image 625
Nefariis Avatar asked Dec 08 '14 23:12

Nefariis


2 Answers

Take a look to the sources linked by Alex P. You can find the answer to some questions there:

What does "over 1" / "over 2" mean?

That is the number of samples taken.

What is the difference between Service, Imp Bg, Receiver, and Imp Fg?

They are different states (Imp Bg means Important Background, and Imp Fg Important Foreground)

Why doesn't every total list the RAM usage (com.google.android.talk for example)

What does 100% mean and what does .03% mean?

% of the time that these apps have been running.

Why do only some have (Cached)/(Home)?

What does 100% (Cached)/(Home) mean?

What does "(partial) libdvm.so chromeview" mean?

Lastly, am I correct in assuming that (4.8MB-4.9MB-5.0MB/3.2MB-3.3MB-3.4MB) is (low pss - avg pss - high pss / low uss - avg uss - high uss)?

Yes, you are corrent, the documentation describes them as minPss-avgPss-maxPss / minUss-avgUss-maxUss

like image 183
naw Avatar answered Nov 08 '22 04:11

naw


The percentages tell you how much of the overall time each process has spent in various key states. The memory numbers tell you about memory samples in those states, as minPss-avgPss-maxPss / minUss-avgUss-maxUss. The procstats tool also has a number of command line options to control its output — use adb shell dumpsys procstats -h to see a list of the available options.

Comparing this raw data from procstats with the visualization of its data we previously saw, we can see that it is showing only process run data from a subset of states: Imp Fg, Imp Bg, Service, Service Rs, and Receiver. These are the situations where the process is actively running in the background, for as long as it needs to complete the work it is doing. In terms of device memory use, these are the process states that tend to cause the most trouble: apps running in the background taking RAM from other things.

Quoted from: http://android-developers.blogspot.be/2014/01/process-stats-understanding-how-your.html Maybe you'll find more information using procstats -h or man procstats.

like image 26
ShellFish Avatar answered Nov 08 '22 03:11

ShellFish