-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,9 @@ authors = ["Cheng XU <[email protected]>"] | |
edition = "2018" | ||
build = "build.rs" | ||
license = "MIT OR Apache-2.0" | ||
description = "Measure how long it takes for a program to execute in different clocks" | ||
repository = "https://github.com/xu-cheng/howlong" | ||
documentation = "https://docs.rs/howlong" | ||
readme = "README.md" | ||
|
||
[dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,51 @@ | ||
# howlong | ||
|
||
This crate allows you to measure how long it takes for a program to execute in different clocks. It ports the functions of the [`boost-chrono`](https://boost.org/libs/chrono) and [`boost-timer`](https://boost.org/libs/timer) libraries. | ||
|
||
The following clocks and their corresponding timers are implemented. | ||
|
||
* `SystemClock`, `SystemTimer` | ||
* `SteadyClock`, `SteadyTimer` if supported by the system. | ||
* `HighResolutionClock`, `HighResolutionTimer` | ||
* `ProcessRealCPUClock`, `ProcessRealCPUTimer` | ||
* `ProcessUserCPUClock`, `ProcessUserCPUTimer` | ||
* `ProcessSystemCPUClock`, `ProcessSystemCPUTimer` | ||
* `ProcessCPUClock`, `ProcessCPUTimer` | ||
* `ThreadClock`, `ThreadTimer` | ||
|
||
## Documentation | ||
|
||
<https://doc.rs/howlong> | ||
|
||
## Usage | ||
|
||
Add this to your `Cargo.toml`: | ||
|
||
```toml | ||
[dependencies] | ||
howlong = "0.1" | ||
``` | ||
|
||
## Examples | ||
|
||
```rust | ||
use howlong::*; | ||
|
||
let timer = HighResolutionTimer::new(); | ||
// do some computations | ||
println!("{:?} have passed.", timer.elapsed()); | ||
|
||
let timer = ProcessCPUTimer::new(); | ||
// do other computations | ||
println!("{}", timer.elapsed()); | ||
``` | ||
|
||
## License | ||
|
||
<sup> | ||
Licensed under either of <a href="LICENSE-APACHE">Apache License, Version 2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option. | ||
</sup> | ||
<br> | ||
<sub> | ||
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. | ||
</sub> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters