Skip to main content

followThePid is a Python library for tracing the CPU usage and energy consumption of a running process using its PID.

Project description

followThePid

followThePid is a Python library for tracing the CPU usage and energy consumption of a running process using its PID. It supports Linux and macOS (Intel and Apple Silicon).


Features

  • Trace CPU usage and energy per sampling interval
  • Option to normalize CPU usage per core (iris mode)
  • Uses Intel RAPL and powermetrics for energy measurements
  • Built-in support for saving data as:
    • CSV file
    • Pandas DataFrame

Requirements

  • Python 3.12+
  • One of:
    • Linux with Intel CPU and RAPL support
    • macOS with Intel CPU or Apple Silicon (M1/M2/M3)
  • sudo/root privileges

Installation

git clone https://github.com/your-username/followThePid.git
cd followThePid
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

RAPL Permissions

Linux (Intel CPUs)

By default, on recent kernels (≥ 5.10), access is restricted to root, as a security mitigation. To allow non-root reads:

# Example Package 0
sudo chmod o+r /sys/class/powercap/intel-rapl:0/energy_uj 

macOS (Intel and M-series)

Energy estimation rely on powermetrics APIs , sudo is needed.

Usage

import followThePid 
monitor = FollowThePid(
    cmd="python my_script.py",

)

# Start monitoring the process
monitor.monitor() 

# Summary
monitor.samples_csv()

Learn More

For detailed information on how followThePid works, supported architectures, and configuration examples,
see the 📘 Wiki.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

followthepid-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

followthepid-0.1.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file followthepid-0.1.0.tar.gz.

File metadata

  • Download URL: followthepid-0.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for followthepid-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1a59843ab714f6420d7e11d6b4267636d28463ce792534cd40a45bee189f0565
MD5 88082a0b52f29b1a1d6caae3d799d59b
BLAKE2b-256 5e57cb13ca826050f7defe5eef3837e642d467b9f87eb82bc2bcf7db59d2133c

See more details on using hashes here.

File details

Details for the file followthepid-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: followthepid-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for followthepid-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43cce41c422b6f7e1d0f3eb0078cddb3338edb8c3edb9ef75c244b045f833dcc
MD5 4accb7f284603054ab135bf0cccefab7
BLAKE2b-256 fb6ab0ac919c9fc69558e663099b30182d259b6fd649a550fe4d15d510bff94f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page