Giter Club home page Giter Club logo

cpslib's Introduction

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

cpslib's People

Contributors

nibrahim avatar k4rtik avatar anmolsarma avatar glossarytingtun avatar powerinside avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.