Hao Shen
Hao Shen

Reputation: 2735

Does any one know the 'top' command 's result's meaning in android?

I have found the result of 'top' is different from result of in standard linux.I have searched on the web a little bit but I can not find my answer. For example, following is the partial result of top in my android:

  PID CPU% S  #THR     VSS     RSS PCY UID      Name
  814   2% R     1    940K    372K  fg root     top
  110   1% S    58 185000K  59216K  fg system   system_server
   31   0% S     1      0K      0K  fg root     vsync_workqueue
   49   0% S     1      0K      0K  fg root     file-storage
   52   0% S     1      0K      0K  fg root     gp2a_wq
  178   0% S     9  98476K  23820K  fg system   com.android.systemui

So #THR probably is the number of threads.But what is 'PCY'? I can not find this information in the /proc/(PID)/ folder. And I have found that if I open an youtube, the PCY will be fg. Then if I quit it(youtube), the youtube process still exists but the PCY will be bg. And in terms of 'S', I have found all processes are always 'S' which means sleeping, even my youtube app is currently active. It's weired...

Does anyone have any clue:> Thx

Upvotes: 20

Views: 13506

Answers (4)

Ross Aiken
Ross Aiken

Reputation: 962

Here's my (un)educated guesses:

PID - Process ID

CPU% - CPU Usage

S - State (or possibly status) R=Running, S=Sleeping

#THR - Number of threads

PCY - I'm kinda stumped here. You seem to have a pretty good grasp of what it does, so that's good enough (assuming that fg and bg are the only possible values)

UID - Name of the user that started the task

Name - This one is self-explanatory...

VSS and RSS: From http://groups.google.com/group/android-beginners/browse_thread/thread/e6f2d396a68238ad?pli=1

Virtual Set Size (sometimes abbreviated VSZ) and Resident Set Size. Googling will turn up some detailed info for Linux. Here's the high speed version:

VSS indicates how much virtual memory is associated with the process, Resident Set Size indicates how many physical pages are associated with the process.

VSS is generally meaningless on Android. If I memory-map a 1MB file, VSS grows by 1MB, but I haven't used any resources (other than entries in a virtual mapping table).

RSS is partially meaningless on Android, because it doesn't identify pages shared between multiple processes. If process A has an RSS of 2MB, and process B has an RSS of 2MB, it's possible that there are 4MB of physical pages occupied. It's also possible that there are only 2MB of physical pages occupied.

EDIT: As far as your Youtube is sleeping deal, if it isn't actively doing anything, it will be sleeping, even if it is in the foreground. Try creating a simple app that is basically while(1){Do something meaningless} and see if it is sleeping or running. Granted it also might be a quirk with the way that Android handles multitasking.

EDIT2:
Mostly-uneducated-somewhat-random-stab-in-the-dark for PCY --
PCY -- Policy -- Determines how an app should be treated by Android's memory manager
FG -- Foreground -- Process is considered a foreground process and should not be killed to free mmemory
BG -- Background -- Process is considered a background process (not actively running in foreground and may be killed to free memory)

Upvotes: 24

kip2
kip2

Reputation: 6883

this page says what VSS and RSS mean, but does not specify how to obtain the more meaningful PSS and USS

Upvotes: -1

evan
evan

Reputation: 318

top sourcecode [ top sourcecode][1]

[1]: http://androidxref.com/4.0.4/xref/system/core/toolbox/top.c#442 to get the complete logic of how each value is calculated

Upvotes: 3

John Carter
John Carter

Reputation: 55271

Try man top on any normal linux / unix (though I don't think Android has man installed by default).

Actually now I look it looks like those column titles aren't mentioned on that man page, but the point stands that man is usually the best place to start looking for information about linux / unix commands.

Upvotes: -1

Related Questions