#execution #measure #display #hours #minutes #elapsed #seconds

execution-time

simple way to measure and display the execution time

6 releases

new 0.1.5 Jan 30, 2025
0.1.4 Jan 30, 2025

#1580 in Command line utilities

Download history

154 downloads per month

BSD-3-Clause

15KB
214 lines

Execution Time

This Rust project provides a simple way to measure and display the execution time of code blocks. It allows you to start a timer and then print the elapsed time in a human-readable format, including days, hours, minutes, and seconds.

Usage

  1. Add the dependency to your Cargo.toml file:

    [dependencies]
    execution-time = "0.1"
    
  2. Import and Use the library in your main.rs file.

    use execution_time::ExecutionTime;
    
    fn main() {
        let timer = ExecutionTime::start();
    
        // Simulate some work being done
        std::thread::sleep(std::time::Duration::from_millis(1234));
    
        // println!("Elapsed time: {}", timer.get_elapsed_time());
        timer.print_elapsed_time();
    }
    

No runtime deps