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
1
vote
1 answer

How does windows task manager performance tab fetches CPU GPU VPU and Memory utilization/Usage

where is the task manager is getting this data and how it is mapping to particular device. basically i'm trying to write a script which fetches the CPU GPU VPU utilization from task manager. We have Psutil for cpu and we have Performance counter for…
Arbaz ali
  • 84
  • 6
1
vote
0 answers

Why does the memory usage shown by psutil differ so much from what cgroups shows?

While running a Python service in Kubernetes (pod with just one container, my Gunicorn process has PID 1), I monitor the memory usage: psutil.Process().memory_full_info() output: pfullmem(rss=669609984, vms=5986619392, shared=229244928, text=4096,…
Tobias Hermann
  • 9,936
  • 6
  • 61
  • 134
1
vote
0 answers

How to relate Python threads to POSIX threads in Python 3.6?

Is there a way to relate the Python thread name and thread ID to the POSIX thread ID in Python 3.6? Any of the following would do: Get the POSIX thread ID from a threading.Thread object Get the Python thread ID from a psutil._common.pthread…
Tom
  • 7,269
  • 1
  • 42
  • 69
1
vote
1 answer

Getting the total CPU usage in python 3 on windows

I am trying to write a program that can measure the overall CPU usage. I tried using psutil.cpu_percent(), but it is returning the CPU usage for only the python process.
1
vote
0 answers

How to find the termination time of the currently running process in my system?

I am currently using psutil package , I have used wmi package also but could not find the termination time of running process. import psutil import datetime for process in psutil.process_iter(['pid', 'username']): pro_id =…
ayush
  • 11
  • 3
1
vote
0 answers

psutil fails to install version 5.9.4 on Mac with poetry

I am run poetry in a conda environment on a Mac. When I try to install psutil with poetry, the process works for version "5.9.2" and "5.9.3" but not for "5.9.4" (the latest at…
tipanverella
  • 3,477
  • 3
  • 25
  • 41
1
vote
0 answers

Python process name showing incorrect name in psutil

I am trying to create a python process and give it an explicit name so that I can find it by its name within the psutil iter object. Somehow, the pid of the created python process is correct, but the name displayed by psutil is "python", while I…
1
vote
0 answers

Python AMD GPU monitoring

I'm trying to make a GPU usage monitor, but I have an AMD GPU, so I had to use the pyadl library instead of some better for NVIDIA. this is my code: from pyadl import * device =…
1
vote
0 answers

How to determine if a process is running in background or foreground using python?

I am doing a project in python in which I want to add a feature like it will kill a background process if it is not running in the foreground. Browsers like firefox and chrome often run in the background after you turn on your computer. I'm using…
1
vote
0 answers

AttributeError: psutil has no attribute 'dirty'

Hello guys I am working on a python3 migration project in which I have upgraded psutil version to 5.9.0 here is a snippet of my code import psutil mem = psutil.virtual_memory() x.add_metric(schema.yy_MEMORY_DIRTY, mem.dirty) but in this getting…
1
vote
1 answer

How keep tracking the external program opened in python?

I want open a program (ex: calculator) and keep tracking his process as the pid, name, etc. But, after calling the subprocess.Popen(), the process id is killed after few time. So i want to initialize this program and get the process id and other…
zero
  • 41
  • 4
1
vote
0 answers

can't get psutil .net_connections() work the same in container

Trying to create an containerized python app that collect host's process network data, I've been using psutil to get the data, when using psutil.net_connection(kind='inet') Inside the docker container the PID value is always None, I have used…
1
vote
0 answers

Read hard disk performance active time

Work on a monitoring application to monitor the performance of the processor and the hard disk The processor performance check part was simple using psutil But it is difficult to get information about the performance of the hard disk from this…
Elabbasy00
  • 628
  • 9
  • 21
1
vote
1 answer

Python - Fetch system data from remote host with psutil and paramiko

I'm currently working on a simple monitoring project. I want to have a dedicated monitoring server that checks several remote instances for cpu, memory and disk usage. I've got two scripts running so far. One script on the monitoring server to…
Kevin Oo
  • 11
  • 2
1
vote
1 answer

psutils, how to correctly calculate a process CPU utilization

I have the following process: PID = 1245 p = psutil.Process(PID) When I calculate the cpu utilization of this process: print(p.cpu_percent()) it gives something like 25%. While the whole CPU utilization is about…
zezo
  • 445
  • 4
  • 16