timelog

Crates.iotimelog
lib.rstimelog
version1.0.5
sourcesrc
created_at2024-10-18 05:37:32.584185
updated_at2024-10-28 08:42:00.784349
descriptionA simple timer for logging time durations like console.time in JavaScript.
homepage
repositoryhttps://github.com/zhangyuang/timelog
max_upload_size
id1413902
size10,655
yuuang (zhangyuang)

documentation

https://docs.rs/timelog

README

timelog

A simple timer library for logging time durations, similar to console.time in JavaScript.

Features

  • Create multiple named timers
  • Start, log, and end timers
  • Print timing results in milliseconds
  • Support for optional additional messages

Installation

Add the following line to your Cargo.toml file:

[dependencies]
timelog = "1.0.0"

Usage

use timelog::Timer;

fn main() {
    let mut timer = Timer::new();

    timer.time("fetch_data");

    let duration: f64 = timer.time_log("fetch_data", true);
    println!("fetch_data took {:.2}ms", duration);
}

Documentation

timelog

Commit count: 10

cargo fmt