Quantcast
Channel: How to monitor CPU/memory usage of a single process? - Unix & Linux Stack Exchange
Browsing all 18 articles
Browse latest View live

Answer by theist for How to monitor CPU/memory usage of a single process?

I'm a bit late here but I'll share my command line trick using just the default ps WATCHED_PID=$({ command_to_profile >log.stdout 2>log.stderr & } && echo $!); while ps -p...

View Article



Answer by ZettaCircl for How to monitor CPU/memory usage of a single process?

Not enough reputation to comment, but for psrecord you can also call it directly, in a programmatic way, directly in Python: from psrecord.main import monitor monitor(<pid number>, logfile =...

View Article

Answer by xebeche for How to monitor CPU/memory usage of a single process?

Using top and awk one could easily create e.g. a comma separated log of %CPU ($9) + %MEM ($10) usage that can later be fed into any statistics and graphing tool. top -b -d $delay -p $pid | awk -v...

View Article

Image may be NSFW.
Clik here to view.

Answer by saaj for How to monitor CPU/memory usage of a single process?

psrecord The following addresses history graph of some sort. Python psrecord package does exactly this. pip install psrecord # local user install sudo apt-get install python-matplotlib python-tk # for...

View Article

Answer by Razan Paul for How to monitor CPU/memory usage of a single process?

If you have a cut-down Linux distribution where top does not have per process (-p) option or related options, you can parse the output of the top command for your process name to get the CPU usage...

View Article


Answer by user4757345 for How to monitor CPU/memory usage of a single process?

If you know process name you can use top -p $(pidof <process_name>)

View Article

Answer by Kieleth for How to monitor CPU/memory usage of a single process?

If you need the averages for a period of time of a specific process, try the accumulative -c option of top: top -c a -pid PID "-c a" found in top for Mac 10.8.5. For Scientific Linux, the option is -S,...

View Article

Answer by Aquarius Power for How to monitor CPU/memory usage of a single...

To use that information on a script you can do this: calcPercCpu.sh #!/bin/bash nPid=$1; nTimes=10; # customize it delay=0.1; # customize it strCalc=`top -d $delay -b -n $nTimes -p $nPid \ |grep $nPid...

View Article


Answer by Denilson Sá Maia for How to monitor CPU/memory usage of a single...

htop is a great replacement to top. It has... Colors! Simple keyboard shortcuts! Scroll the list using the arrow keys! Kill a process without leaving and without taking note of the PID! Mark multiple...

View Article


Answer by Hemant for How to monitor CPU/memory usage of a single process?

I normally use following two : HP caliper : its very good tool for monitoring processes it you can check call graph and other low level information also. But please note its free only for personal use....

View Article

Answer by Michael Mrozek for How to monitor CPU/memory usage of a single...

On Linux, top actually supports focusing on a single process, although it naturally doesn't have a history graph: top -p PID This is also available on Mac OS X with a different syntax: top -pid PID

View Article

How to monitor CPU/memory usage of a single process?

I would like to monitor one process's memory / cpu usage in real time. Similar to top but targeted at only one process, preferably with a history graph of some sort.

View Article

Answer by 赵宝磊 for How to monitor CPU/memory usage of a single process?

pidstat -p 7994 2 03:54:43 PM UID PID %usr %system %guest %CPU CPU Command03:54:45 PM 0 7994 1.50 1.50 0.00 3.00 1 AliYunDun03:54:47 PM 0 7994 1.00 1.00 0.00 2.00 0 AliYunDunevery 2 seconds print...

View Article


Image may be NSFW.
Clik here to view.

Answer by Halil Kaskavalci for How to monitor CPU/memory usage of a single...

MacOS solution to create the following graph# Install dependenciesbrew install gnuplot libmagic # Sample process. Replace 1234 with process IDwhile :;do ps -p 1234 -o %cpu= >> procdata.txt;sleep...

View Article

Answer by Ciro Santilli ПутлерКапут六四事 for How to monitor CPU/memory usage of...

Launch a program and monitor itThis form is useful if you want to benchmark an executable easily:topp() ( if [ -n "$O" ]; then $* & else $* &>/dev/null & fi pid="$!" trap "kill $pid"...

View Article


Answer by Markus Dutschke for How to monitor CPU/memory usage of a single...

bash script tracking resources of a processHere some example script, which might come handy. Works just with ps and top. As an example process I chose a python script (high cpu utilization, 3 seconds...

View Article

Image may be NSFW.
Clik here to view.

Answer by Luca Carlon for How to monitor CPU/memory usage of a single process?

Monitoring memory usage is something I frequently need when testing C++ apps. I used the solutions already provided in the previous answers and I also wrote a little app for myself and I made it...

View Article


Answer by Denilson Sá Maia for How to monitor CPU/memory usage of a single...

Fabien Sanglard built a tool for exploring the Linux command-line space time. It analyzes how many threads/processes, how much time, and how much memory a certain commandline used. You can learn more...

View Article
Browsing all 18 articles
Browse latest View live




Latest Images