Skip to content
forked from hamon-in/cpslib

Cross platform library to gather process and system information.

License

Notifications You must be signed in to change notification settings

nibrahim/cpslib

This branch is up to date with hamon-in/cpslib:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1f36232 · Nov 21, 2017
Feb 11, 2016
Feb 11, 2016
Jan 3, 2016
Jan 1, 2016
Nov 21, 2017
Jan 7, 2016
Dec 22, 2014
Aug 1, 2017
Jan 12, 2016
Jan 8, 2016
Jan 17, 2016
Oct 9, 2016
Jan 12, 2016
Aug 1, 2017
Aug 1, 2017

Repository files navigation

Introduction

cpslib is an attempt to port the excellent Python library psutil to C and then write wrappers for it in other languages (like Rust).

Design

There are 3 platform specific files which implement all the API calls mentioned in the documentation. They will hide the details of the actual OS level function which is called to get the job done. The top level header file pslib.h has all the constants and structures necessary to provide the cross platform API.

Open questions

  • The Process structure contains information which will change after it is initialized. It might be a good idea to keep the fields inside the structure minimal and provide functions which will retrieve various attributes on demand.
  • I'm unsure about the types I've used in the wrapper functions. I've indiscriminately used basic numeric types for various system parameters like process id etc.

Status of implementation

APIs available

This is a quick list of the APIs currently implemented. Proper documentation will be done separately.

  • disk_usage - Information on total, used and free space on a partition
  • disk_partitions - Information on disk partitions on the system (device, mountpoint, type and options).
  • disk_io_counters - Information on disk I/O counters (number of reads/writes, bytes read/written, readtime, writetime).
  • net_io_counters - Information I/O counters on network interfaces (bytes/packets sent/received, input/output errors/drops).
  • get_users - List of users logged in and their information (username, tty, hostname and timestamp).
  • get_boot_time - Returns time of system boot.
  • virtual_memory - Returns Virtual memory information (used, free, available etc.)
  • logical_cpu_count - Returns number of logical CPUs.
  • physical_cpu_count - Returns number of physical CPUs.
  • cpu_count - Entry point for above functions.
  • get_process - Get detailed information about a process.

Platforms supported

  • Linux - In progress
  • OS X - In progress
  • *BSD - Planned
  • Windows - Planned

About

Cross platform library to gather process and system information.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 82.1%
  • Python 15.9%
  • Makefile 2.0%