icentral-timer 0.1.0

A Rust crate providing a concise, mutable timer for measuring time intervals with high precision, leveraging RefCell and Instant for seamless concurrency.
Documentation
  • Coverage
  • 0%
    0 out of 2 items documented0 out of 0 items with examples
  • Size
  • Source code size: 48.95 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.79 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 36s Average build duration of successful builds.
  • all releases: 1m 36s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • klebs6

icentral-timer

icentral-timer is a highly efficient Rust-based crate designed to accurately measure the time interval between two events. It leverages the system's high-resolution clock to provide precise timing capabilities, making it ideal for performance-sensitive applications in various domains.

Overview

The core component is the Timer struct, encapsulating timing logic with an elegant, minimalistic interface. Utilizing Rust's RefCell and Instant, the Timer ensures both mutability and thread safety, allowing for versatility in concurrent applications.

Timer Struct

  • start: Implements the high-resolution starting point for measurement.
  • stop: Records the precise moment of stopping, permitting multiple readings.

Usage

  • start(): Initiates timing, marked by the current instant.
  • stop(): Concludes timing, determining the interval.
  • interval(): Computes the duration between start and stop, returning a Duration object.

Example

use icentral_timer::Timer;

let mut timer = Timer::default();
timer.start();
// Perform some operations here
let duration = timer.interval();
println!("Elapsed time: {:?}", duration);

Installation

Add the following to your Cargo.toml:

[dependencies]
icentral-timer = "0.1.0"

Why Use icentral-timer?

  • Precision: Optimized for high-resolution timing.
  • Simplicity: Intuitive API minimizes boilerplate code.
  • Concurrency Safety: Suited for multi-threaded environments.

License

This project is licensed under the MIT License.


This README.md file was generated by an AI model and may not be 100% accurate; however, it should be pretty good.

This crate is in the process of being translated from c++ to rust. Currently, it still needs exhaustive testing. It is likely there currently exist many glitches which need to be fixed before proper usage. This crate is based on the original icentral program developed by Fuad Jamor. Please see the following repository for details: https://github.com/fjamour/icentral.

For progress updates, see the workspacer rust project.