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
From the top man page: 'D' = uninterruptible sleep 'R' = running 'S' = sleeping 'T' = traced or stopped 'Z' = zombie. 'R' is the easiest; the process is ready to run, and will run whenever its turn to use the CPU comes.
The top (table of processes) command shows a real-time view of running processes in Linux and displays kernel-managed tasks. The command also provides a system information summary that shows resource utilization, including CPU and memory usage.
The top command is used for memory monitoring. It works only on Linux platform. The top command produces an ordered list of running processes selected by user-specified criteria, and updates it periodically. By default, ordering is by CPU usage, and it shows processes that consume maximum CPU.
See the Full Command LinePressing “c” toggles the COMMAND column between displaying the process name and the full command line. To see a “tree” of processes that were launched or spawned by other processes, press V.
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)
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With