In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to install ps_mem through the package manager in linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Ps_mem is a simple python script that can help us accurately get the core memory usage of each program in Linux. Although there are many tools available on Linux to view memory usage, such as free, vmstat, smem, top, etc., this tool differs from others in that it accurately shows core memory usage.
It calculates the total private memory and shared memory of a program, respectively, and gives the total memory usage in a more accurate way. Obviously, it will help you know which program in the system is taking up more memory.
You can install ps_mem tools in a variety of ways, such as the package manager, pip, or running ps_mem.py scripts directly. It is important to note that root permission is required.
In addition, it is recommended to read the following memory tools:
Free-A standard tool for viewing memory usage statistics (available and used) on Linux
Smem-Linux memory report / Statistics tool
Vmstat-A useful standard tool for virtual memory statistics
Install ps_mem through the package manager
The default repository for RHEL-based systems contains ps_mem tools, so we can simply install them through the package manager.
For RHEL/CentOS, use the yum package manager to install the ps_mem package:
$sudo yum install ps_mem
For Fedora, use the dnf package manager to install the ps_mem package:
$sudo dnf install ps_mem
For Arch Linux, use the pacman package manager to install the ps_mem package:
$sudo pacman-S ps_mem
Install ps_mem through pip
Pip is a recommended tool for installing Python packages on Linux. You can use the pip command instead of the package manager to get the version of *. Before using the pip package, make sure that the pip package is installed on your system. Otherwise, install the python-pip package first using the distributed package manager.
For Debian-based systems:
$sudo apt-get install python-pip
For RHEL/CentOS-based systems:
$sudo yum install python-pip
For Fedora
$sudo dnf install python-pip
For openSUSE
$sudo zypper install python-pip
For Arch Linux-based systems:
$sudo pacman-S python-pip
*, run the pip tool on Linux to install ps_mem:
$sudo pip install ps_mem
Run the ps_mem.py script directly
We can also download the file from the developer's github page and run the ps_mem.py script directly.
$git clone https://github.com/pixelb/ps_mem.git & & cd ps_mem $sudo python ps_mem.py
How to use ps_mem
Run ps_mem directly without any parameters to get exactly the core memory usage of each program.
$sudo ps_mem Private + Shared = RAM used Program 1.6 MiB + 438.5 KiB = 2.1 MiB packagekitd 1.7 MiB + 498.0 KiB = 2.1 MiB indicator-application-service 912.0 KiB + 1.3 MiB = 2.2 MiB window-stack-bridge 2.0 MiB + 350.5 KiB = 2.3 MiB gnome-keyring-daemon 1.8 MiB + 575.0 KiB = 2.3 MiB whoopsie 2.4 MiB + 304.5 KiB = 2.7 MiB systemd-journald 2.7 MiB + 157.5 KiB = 2.8 MiB ibus-engine-simple 2.7 MiB + 182.0 KiB = 2.9 MiB ibus-dconf 2.7 MiB + 332.5 KiB = 3.0 MiB NetworkManager 3.1 MiB + 169.5 KiB = 3.2 MiB polkitd 1.9 MiB + 1.7 MiB = 3.6 MiB systemd (2) 3.4 MiB + 172.5 KiB = 3.6MiB deja-dup-monitor 2.9MiB + 685.0 KiB = 3.6MiB zeitgeist-datahub 2.9MiB + 848.0 KiB = 3.7MiB python2.7. . . . . . 222.1 MiB + 9.4MiB = 231.5 MiB compiz 286.2 MiB + 11.8MiB = 298.0 MiB firefox-- 1.3GiB = =
Print the full path in the output:
$sudo ps_mem-s Private + Shared = RAM used Program 3.2 MiB + 951.0 KiB = 4.1 MiB / usr/lib/evolution/evolution-addressbook-factory 3.7 MiB + 826.5 KiB = 4.5 MiB / usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 3.7 MiB + 853.0 KiB = 4.6 MiB / usr/lib/unity-settings-daemon/unity-fallback-mount-helper. . . . . . 131.9 MiB + 168.0 KiB = 132.1 MiB / usr/sbin/mysqld 222.1 MiB + 9.4 MiB = 231.5 MiB / usr/bin/compiz 286.2 MiB + 11.8 MiB = 298.1 MiB / usr/lib/firefox/firefox-- 1.3 GiB = =
Only the memory usage for a specific PID list is displayed:
$sudo ps_mem-p 2886 sudo ps_mem 4386 Private + Shared = RAM used Program 13.5 MiB + 2.9 MiB = 16.4 MiB gnome-terminal-server 286.2 MiB + 11.8 MiB = 298.0 MiB firefox-- 314.4 MiB = =
Print process memory every N seconds. The following command reports memory usage every 2 seconds:
$sudo ps_mem w 2
Displays only the total amount of memory:
$sudo ps_mem-t 1329884160 Thank you for reading! This is the end of the article on "how to install ps_mem through the package manager in linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.