Skip to main content

Linux system information library

Project description

sysutil-lib

  • Linux system information library

Warning

  • this library is ment to be used only in linux systems
  • it is possible to write code using it on other systems, but it will not allow to run the code, raising an exception before execution

Other implementations

  • this library is also available for Rust
  • check it out at crates.io

Importation

import sysutil

Data structures

ProcessorUsage

class ProcessorUsage:
    total: float
    user: float
    nice: float
    system: float
    idle: float
    iowait: float
    interrupt: float
    soft_interrupt: float
  • data structure which encloses the different parameters relative to processor usage

CpuUsage

class CpuUsage:
    average: ProcessorUsage
    processors: [ProcessorUsage]
  • contains the average CPU usage, and the specific usage for each processor

CpuInfo

class CpuInfo:
    modelName: str
    cores: int
    threads: int
    dies: int
    governors: [str]
    maxFrequencyMHz: float
    clockBoost: bool
    architecture: str
    byteOrder: str
  • contains base information relative to the CPU

SchedulerPolicy

class SchedulerPolicy:
    name: str
    scalingGovernor: str
    scalingDriver: str
    minimumScalingMHz: float
    maximumScalingMHz: float
  • contains scheduler information relative to a processor in your system

RamSize

class RamSize:
    gb: float
    gib: float
  • contains total ram size, both in GB (1000^3 bytes) and GiB (1024^3 bytes)

NetworkRate

class NetworkRate:
    download: float
    upload: float
  • contains total upload and download network rate (in bytes)

TemperatureSensor

class TemperatureSensor:
    label: str
    temperature: float
  • contains sensor name (label) and the recorded temperature

Battery

class Battery:
    capacity: int
    status: str
  • contains capacity and status of battery

VramSize

class VramSize:
    gb: float
    gib: float
  • contains total gpu's vram size, both in GB (1000^3 bytes) and GiB (1024^3 bytes)

RouteType

class RouteType:
    TCP = 'tcp'
    TCP6 = 'tcp6'
    UDP = 'udp'
    UDP6 = 'udp6'

NetworkRoute

class NetworkRoute:
    routeType: str
    localAddress: str
    localPort: int
    remoteAddress: str
    remotePort: int
  • represents a network route

CPU

class CPU:
    info: CpuInfo
    averageUsage: ProcessorUsage
    perProcessorUsage: [ProcessorUsage]
    schedulerPolicies: [SchedulerPolicy]
  • encloses all cpu data available in the library

Methods

cpu = CPU()
  • standard constructor
cpu = CPU()

cpu.update()
  • update() method updates usages and scheduler status

Clocksource

class ClockSource:
    current: str
    available: [str]
  • contains current clock source and the available ones

Bios

class Bios:
    vendor: str
    release: str
    version: str
    date: str
  • contains information relative to the installed bios

Motherboard

class Motherboard:
    name: str
    vendor: str
    version: str
    bios: Bios
  • contains information relative to the motherboard and the installed bios

GpuMetrics

class GpuMetrics:
    temperatureEdge: int
    temperatureHotspot: int
    temperatureMem: int
    temperatureVrgfx: int
    temperatureVrsoc: int
    temperatureVrmem: int
    averageSocketPower: int
    averageGfxclkFrequency: int
    averageSockclkFrequency: int
    averageUclkFrequency: int
    currentGfxclk: int
    currentSockclk: int
    throttleStatus: int
    currentFanSpeed: int
    pcieLinkWidth: int
    pcieLinkSpeed: int
  • encloses gpu metrics parameters

Bytesize

class ByteSize:
    __bytes: int
  • Bytes size data structure implementing methods to convert in various size orders

NvmeDevice

class NvmeDevice:
    device: str
    pcieAddress: str
    model: str
    linkSpeedGTs: float
    pcieLanes: int
    size: ByteSize
    partitions: [StoragePartition]
  • Contains NVME device information

StoragePartition

class StoragePartition:
    device: str
    mountPoint: str
    filesystem: str
    size: ByteSize
    startPoint: str
  • Encloses device name, size and startpoint relative to a partition

StorageDevice

class StorageDevice:
    model: str
    device: str
    size: ByteSize
    partitions: [StoragePartition]
  • Contains information relative to a storage device in the system

Frequency

class Frequency:
    _khz: float
  • Contains frequency value in kHz, implements conversion methods for kHz, MHz, GHz

ProcessorFrequency

class ProcessorFrequency:
    processorID: str
    frequency: Frequency
  • Contains processor id and its frequency

CpuFrequency

class CpuFrequency:
    average: Frequency
    processors: [ProcessorFrequency]
  • Contains cpu frequency, both average and processor wise

Backlight

class Backlight:
    brightness: int
    maxBrightness: int
  • Holds information about backlight

Functions

def cpuUsage() -> CpuUsage
  • returns the cpu usage, both average and processor-wise, all the values are percentage
def cpuFrequency() -> CpuFrequency
  • returns CPU frequency, both average and processor wise
def ramUsage() -> float
  • returns ram usage percentage
def networkRate() -> NetworkRate
  • returns network rate (download and upload), expressed in bytes
def temperatureSensors() -> [TemperatureSensor]
  • returns every temperature sensor in TemperatureSensor format
def cpuInfo() -> CpuInfo
  • returns the cpu base information, enclosed in the CpuInfo data structure
def ramSize() -> RamSize
  • returns ram size as specified in the RamSize data structure
def schedulerInfo() -> [SchedulerPolicy]
  • returns scheduler information for each processor
def gpuUsage() -> float
  • returns gpu usage percentage
  • yet tested only on AMD 7000 series GPUs, returns None in case it's not capable to retrieve information
def batteryInfo() -> Battery 
  • returns battery status and capacity
def vramSize() -> VramSize
  • returns vram size as specified in the VramSize data structure
def vramUsage() -> float
  • returns vram usage percentage
def networkRoutes() -> [NetworkRoute]
  • returns a list containing each internal network route
def clockSource() -> ClockSource
  • returns the currently active clock source and the different ones available, enclosed in ClockSource struct
def biosInfo() -> Bios
  • returns information about the currently installed BIOS
def motherboardInfo() -> Motherboard
  • returns information about the motherboard
def gpuMetrics() -> GpuMetrics
  • returns metrics parameters from the amdgpu driver
def nvmeDevices() -> [NvmeDevices]
  • Returns a vector containing all NVME devices found in the system
def storageDevices() -> [StorageDevices]
  • Returns a vector containing all storage devices (NVME excluded) in the system
def getBacklight() -> Backlight
  • Returns the current backlight brightness and the maximum possible value or None if it's not possible to retrieve data

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

sysutil_lib-0.4.9.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

sysutil_lib-0.4.9-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file sysutil_lib-0.4.9.tar.gz.

File metadata

  • Download URL: sysutil_lib-0.4.9.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for sysutil_lib-0.4.9.tar.gz
Algorithm Hash digest
SHA256 fa2b624fbf34f22f7843355ef071b6769bc410e84ba20a749d958ba0a29417fa
MD5 63d728fdf068fe4c16d6b20fba5470ae
BLAKE2b-256 eee64ac99797e556a71c69c6d461f9f446172db0fe1211b345c50a6ad6c05105

See more details on using hashes here.

File details

Details for the file sysutil_lib-0.4.9-py3-none-any.whl.

File metadata

  • Download URL: sysutil_lib-0.4.9-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for sysutil_lib-0.4.9-py3-none-any.whl
Algorithm Hash digest
SHA256 6d2428a892588c56f683b93ea9f8ff5607e45c5b3e843348e8fb9e45d2e2acce
MD5 13d2a3a816830a2d941e3a2ff31d189b
BLAKE2b-256 545c197dd9bedb53e98cf10f9cc64a9981570770bc5e474f6d4688c0564ac59d

See more details on using hashes here.

Supported by

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