MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

Using top

The top tool provides CPU and memory usage estimates from the /proc/ file system.

A simplified version of top is preinstalled on the Harmattan device. Compared to top, the separately downloadable htop is a more versatile tool.

The top and htop tools can be used to monitor and find out which processes are taking the most CPU or memory so that you know which issue or which process to investigate to solve the performance problem.

Using the tool

For specific instructions, see top manual page.

Output example:

top - 11:56:25 up 120 days,  1:40,  8 users,  load average: 0.28, 0.16, 0.10
Tasks: 124 total,   1 running, 122 sleeping,   1 stopped,   0 zombie
Cpu(s):  1.3%us,  0.2%sy,  0.0%ni, 98.3%id,  0.2%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2074208k total,  1713704k used,   360504k free,   413784k buffers
Swap:  2650684k total,   210308k used,  2440376k free,   201172k cached

  PID USER      PR  NI  VIRT  RES  SHR S-%CPU-%MEM    TIME+  COMMAND            
13730 etammine  20   0  473m 332m  21m S   24 16.4   1539:10 xulrunner-stub     
 3324 root      20   0  254m  86m 8108 S    2  4.3   1745:21 Xorg               
    1 root      20   0  1980  460  404 S    0  0.0   0:44.74 init               
    2 root      15  -5     0    0    0 S    0  0.0   0:00.04 kthreadd           
    3 root      RT  -5     0    0    0 S    0  0.0   0:01.04 migration/0        
    4 root      15  -5     0    0    0 S    0  0.0   8:45.82 ksoftirqd/0        
    5 root      RT  -5     0    0    0 S    0  0.0   0:00.50 watchdog/0

The following table presents the output of the tool.

Descriptions of the top tool output fields
Field Description
PID The task’s unique process ID, which periodically wraps, though never restarting at zero.
PPID The process ID of a task’s parent.
USER The effective user name of the task’s owner.
PR The priority of the task.
NI The nice value of the task. A negative nice value means higher priority, whereas a positive nice value means lower priority. Zero in this field simply means priority will not be adjusted in determining a task’s dispatchability.
VIRT The total amount of virtual memory used by the task, in kB. It includes all code, data and shared libraries and pages that have been swapped out, and pages that have been mapped but not used. VIRT = SWAP + RES.
RES The resident/non-swapped physical memory a task has reserved, in kB. RES = CODE + DATA.
SHR The amount of shared memory used by a task, in kB. It simply reflects memory that could be potentially shared with other processes.
S The status of the task which can be one of: ’D’ = uninterruptible sleep, ’R’ = running, ’S’ = sleeping, ’T’ = traced or stopped,’Z’ = zombie
%CPU The task’s share of the elapsed CPU time since the last screen update, expressed as a percentage of total CPU time.
%MEM A task’s currently used share (RES) of available physical memory.
TIME+ Total CPU time the task has used since it started.
COMMAND The command line used to start a task or the name of the associated program. You toggle between command line and name with ’c’, which is both a command-line option and an interactive command.