Questions tagged [psutil]

psutil (python system and process utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network) in Python.

psutil (process and system utilities) is a cross-platform library for retrieving information on running processes and system utilization (CPU, memory, disks, network) in Python. It is useful mainly for system monitoring, profiling and limiting process resources and management of running processes. It implements many functionalities offered by command line tools such as: ps, top, lsof, netstat, ifconfig, who, df, kill, free, nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap. It currently supports Linux, Windows, OSX, Sun Solaris, FreeBSD, OpenBSD and NetBSD, both 32-bit and 64-bit architectures, with Python versions from 2.6 to 3.5.

Resources:

481 questions
3
votes
1 answer

Access Denied Python Script Pstuil

So basically I have Created this application in python that uses Psutil. Iam using it to suspend and resume a process at very high speeds. Although it does work for the majority of the process it doesn't work for some. Ill provide the error code…
Jacob .G.
  • 31
  • 4
3
votes
4 answers

How to wait for the start of a child process?

I execute a process (using Popen) and after a while, this process executes a child process. What I'm trying to do is wait for the child process to be spawned and then continue executing my script. The only way that I found, is using psutil and…
cydan
  • 615
  • 5
  • 17
3
votes
0 answers

How upgrade the build system from 10.7 to 10.12 in Sierra?

I am trying to install a python package which fails while building psutils with the following error. error: command 'gcc' failed with exit status 1 ---------------------------------------- Failed building wheel for psutil In the error log it…
Akash Tripathy
  • 117
  • 2
  • 6
3
votes
2 answers

python psutil get numbers of cpu sockets

it's possible to know numbers of sockets in my computer with python (and psutil ?) for example with psutil i can to get numbers of core, but can i the number of sockets in mothercard ? My computer have 2 sockets (and 2 xeon cpu)
3
votes
0 answers

Set subprocess cpu affinity, run with mpiexec -> Job scheduler can't kill job

[[ Problem ]] I use the psutil library to set cpu affinity of subprocess, and run with mpirun and job scheduler. After I delete the job from job scheduler, I ssh into the node. When I use ps aux to check, the python main process and the 11 python…
rxu
  • 1,369
  • 1
  • 11
  • 29
3
votes
2 answers

How to get original command line from process with python?

import psutil for p in psutil.process_iter(): if p.name() == 'foo': print p.cmdline() print ' '.join(p.cmdline()) PROCESS: foo -p "Hello World" RESULT: ['foo', '-p', 'Hello World'] foo -p Hello World I wish to get…
oblitum
  • 11,380
  • 6
  • 54
  • 120
3
votes
4 answers

how to get the cpu usage of past 10 minutes in python

I am able to get current cpu usage details using following code import psutil as PSUTIL PSUTIL.cpu_percent(interval=1) My question is; how can i get the past 10 minutes cpu usage details?
Abdul Razak
  • 2,654
  • 2
  • 18
  • 24
3
votes
1 answer

Python's psutils -- will it reflect CPU Load similar to top/monit?

I'm writing a program that will perform some logging of my company's webserver load. One information I need to log is the server's CPU Load. I know that CPU Load -- in monit or top/htop -- reflects the total load across cores, normalized against 1…
pepoluan
  • 6,132
  • 4
  • 46
  • 76
3
votes
1 answer

measure elapsed time, amount of memory and cpu used by the extern program

I'm executing an external program through Python. I want to know what is the best choice for calling the outside program, with subprocess.Popen() or with subprocess.call(). Also, I need to measure elapsed time, the amount of memory and CPU used by…
C. Porto
  • 631
  • 3
  • 12
  • 26
3
votes
2 answers

psutil processes that are not running, or reused or are dead or zombie

What does psutil.process_iter() include? Since, its a cached instance, does it include only processes that are running at the time or it includes everything and leaves their present status to be user verified? My code: for _process in…
user3432110
  • 217
  • 1
  • 5
  • 11
2
votes
0 answers

Pytest doesn't work with psutil + xlwings

I found another SO addressing a similar problem but no one gave an answer. My problem is the following (and a bit simpler to reproduce), create a file called test_file.py with: import psutil import xlwings def test() -> None: …
2
votes
2 answers

Docker centos7 image: psutil get installed on Windows/Linux but failed on Mac

This Dockerfile works fine on Windows/Linux FROM centos:centos7 RUN yum -y install python3 gcc RUN pip3 install --upgrade pip RUN pip3 install psutil I build the image by doing docker build -t anytag . but the same Dockerfile fails on MacOS. I…
Freddy
  • 779
  • 1
  • 6
  • 20
2
votes
2 answers

Detecting application start up with python

I've working on a windows python program and I need it to run once I open an app. Is it possible ? If so how would I implement it ?
user18465514
2
votes
1 answer

Does iowait time counted while psutil.cpu_percent are called?

I want to know if iowait time are counted in psutil.cpu_percent(), so write a code as below to test #cat test.py import os import psutil import time p = psutil.Process(os.getpid()) start = time.time() times_before_workload = p.cpu_times() # this…
Kramer Li
  • 2,284
  • 5
  • 27
  • 55
2
votes
0 answers

Can the same Spacy model take on different amount of memory, and if so what is the reason?

I have been experiencing a thing I am not able to explain myself. I want to find the impact in memory of a spacy model inside a Python process. The question I am trying to answer is how many workers I can spin up with gunicorn given that each worker…
Mattia Paterna
  • 1,268
  • 3
  • 15
  • 31