To view the memory consumed by a process

Source: Internet
Author: User
Tags cpu usage



650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/83/84/wKiom1d00CuRPHqfAABwIFvMqwI135.png "title=" 5mplhk1zztwjdun4v_q3tix.png "alt=" Wkiom1d00curphqfaabwifvmqwi135.png "/>


You can view the contents of the%mem directly after you use the top command. You can choose to view by process or view by user, if you want to see the Java user's process memory usage, you can use the following command:

(1) Top

The top command is a common performance analysis tool under Linux that shows the resource usage of individual processes in the system in real time, similar to the Task Manager for Windows

You can view the contents of the%mem directly after you use the top command. You can choose to view by process or view by user, and you can use the following command if you want to see the process memory usage of the Tomcat User:
$ top-u Tomcat

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/83/84/wKiom1d00ajhnNZfAACWXLOmJ0M665.png "title=" p728sn9$d) i_o6m]v544mps.png "alt=" wkiom1d00ajhnnzfaacwxlomj0m665.png "/> Content Interpretation:

PID: ID of the process
USER: Process Owner
PR: The priority level of the process, the smaller the higher the priority is executed
Ninice: Value
VIRT: Virtual memory consumed by the process
RES: The physical memory occupied by the process
SHR: Shared memory used by the process
S: The state of the process. s for hibernation, R for running, Z for Zombie, n for the process priority value is negative
%CPU: Process Consuming CPU utilization
%MEM: The percentage of physical memory and total memory used by the process
Time+: The total CPU time that is consumed after the process is started, which is the cumulative value of the CPU usage time.
Command: Process start name

Common commands:

P: Ranked by%CPU usage rate
T: Rank by mite+
M: Ranked by%mem

(2) Pmap

Depending on the process, you can view the memory used by the process-related information (the process number can be viewed through pgrep) as follows:
$ pmap-d 14596 (slightly)
(3) PS

As shown in the following example:
$ ps-e-O ' pid,comm,args,pcpu,rsz,vsz,stime,user,uid ' where Rsz is the actual memory


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/83/84/wKiom1d00fOB0UuEAAEA80pePqM610.png "title=" NA ' {(I }o6qi5ih94wcpx]sj.png "alt=" Wkiom1d00fob0uueaaea80pepqm610.png "/>


$ ps-e-o ' pid,comm,args,pcpu,rsz,vsz,stime,user,uid ' |  grep java | Sort-nrk5

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/83/84/wKiom1d00n-xNDlwAAAkQCqnwEA111.png "title=" LHEKUAJ7}) S36 (2{9bi5wah.png "alt=" Wkiom1d00n-xndlwaaakqcqnwea111.png "/>

Where Rsz is the actual memory, the above example is implemented by memory sort, from large to small

The above can only prove that some processes occupy memory, obviously need to optimize, and so on later supplement.


This article from "The river, Laugh and Laugh" blog, declined reproduced!

To view the memory consumed by a process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.