2 stable releases

1.0.1 Jun 18, 2024

#2054 in Command line utilities

MIT license

15KB
266 lines

ChronoLogger

Rust clippy rustfmt tests license: MIT

Table of Contents

Overview

ChronoLogger is a Rust command-line tool designed to log CPU and memory usage of processes to a CSV file at regular intervals.

Features

  • CSV Writing: Writes process information including timestamp, PID, process name, CPU usage, and memory usage.
  • Configurable Interval: Set the logging interval in seconds.
  • Configurable Duration: Set the maximum duration to run the logger.
  • Signal Handling: Gracefully handles termination signals (SIGINT, SIGTERM).

Requirements

  • Rust 1.79+

Installation

  1. Ensure Rust 1.56 or higher is installed on your system.
  2. Install the crate from crates.io:
cargo install chronologger

Usage

Run the application from the command line. Default values will be used if no arguments are provided.

chronologger

You can also specify the desired parameters. For example:

chronologger --interval 2 --output custom_output.csv --duration 120

Command-Line Arguments

  • -i, --interval: Sets the logging interval in seconds. Default: 1
  • -o, --output: Sets the output CSV file. Default: 'process_usage.csv'
  • -d, --duration: Sets the maximum duration to run in seconds. Default: 60

Examples

Default Parameters

Run ChronoLogger with default parameters. This will write process information every second for 60 seconds and save it to process_usage.csv.

chronologger

Custom Interval and Output File

Write process information every 2 seconds for 120 seconds and save it to custom_output.csv.

chronologger --interval 2 --output custom_output.csv --duration 120

Short Duration

Write process information for 10 seconds.

chronologger --duration 10

License

This software is released under the MIT License.

Contact

For support or contributions, please contact Jacob Coleman.

Dependencies

~9–21MB
~276K SLoC