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.1.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.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: followthepid-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 705501455c48af4dc9b015bac6fe82e434523528ab5c06deca872eeaffc331d9
MD5 43cbbf797266f8a8fb2cc06d44f66ceb
BLAKE2b-256 945cad5393b59566e0249226a7127f5a84aaa2c152e1bf8882e0cd0f84ed059b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: followthepid-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 28e00b79e574a4e27dd6999ac918094c1ff577e47b811501ec7962ad38784d4e
MD5 cafa6545395d218bc711cd25ed4a3a91
BLAKE2b-256 9e47cea0f3639f134cfe749de830c7b6e0e4595a904fa214e7354d02dbff8635

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