mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-20 11:21:39 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85293b50fd | ||
|
|
ecf8a24b1e | ||
|
|
975a25ce44 | ||
|
|
9cdb9c4c50 | ||
|
|
ba98c8c44b |
No files matched your search
@@ -18,7 +18,7 @@ jobs:
|
|||||||
name: Extract crate metadata
|
name: Extract crate metadata
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- name: Extract crate information
|
- name: Extract crate information
|
||||||
id: crate_metadata
|
id: crate_metadata
|
||||||
run: |
|
run: |
|
||||||
@@ -49,7 +49,7 @@ jobs:
|
|||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
components: rustfmt
|
components: rustfmt
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- run: cargo fmt -- --check
|
- run: cargo fmt -- --check
|
||||||
|
|
||||||
min_version:
|
min_version:
|
||||||
@@ -58,7 +58,7 @@ jobs:
|
|||||||
needs: crate_metadata
|
needs: crate_metadata
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source code
|
- name: Checkout source code
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Install rust toolchain (v${{ needs.crate_metadata.outputs.msrv }})
|
- name: Install rust toolchain (v${{ needs.crate_metadata.outputs.msrv }})
|
||||||
uses: dtolnay/rust-toolchain@master
|
uses: dtolnay/rust-toolchain@master
|
||||||
@@ -96,7 +96,7 @@ jobs:
|
|||||||
BUILD_CMD: cargo
|
BUILD_CMD: cargo
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source code
|
- name: Checkout source code
|
||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Install prerequisites
|
- name: Install prerequisites
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
+3
-1
@@ -4,7 +4,9 @@ pub use uom::num_traits::Zero;
|
|||||||
pub use uom::si::f64::{Information, Ratio, Time};
|
pub use uom::si::f64::{Information, Ratio, Time};
|
||||||
pub use uom::si::information::byte;
|
pub use uom::si::information::byte;
|
||||||
pub use uom::si::ratio::ratio;
|
pub use uom::si::ratio::ratio;
|
||||||
pub use uom::si::time::{microsecond, nanosecond, second};
|
#[cfg(any(not(windows), test))]
|
||||||
|
pub use uom::si::time::microsecond;
|
||||||
|
pub use uom::si::time::{nanosecond, second};
|
||||||
|
|
||||||
pub use units::TimeUnit;
|
pub use units::TimeUnit;
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,7 @@ use windows_sys::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::quantity::{microsecond, Information, Time, Zero};
|
use crate::quantity::{nanosecond, Information, Time, Zero};
|
||||||
|
|
||||||
const HUNDRED_NS_PER_MS: i64 = 10;
|
|
||||||
|
|
||||||
#[cfg(not(feature = "windows_process_extensions_main_thread_handle"))]
|
#[cfg(not(feature = "windows_process_extensions_main_thread_handle"))]
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
@@ -108,17 +106,14 @@ impl CPUTimer {
|
|||||||
// The `TotalUserTime` is "The total amount of user-mode execution time for
|
// The `TotalUserTime` is "The total amount of user-mode execution time for
|
||||||
// all active processes associated with the job, as well as all terminated processes no
|
// all active processes associated with the job, as well as all terminated processes no
|
||||||
// longer associated with the job, in 100-nanosecond ticks."
|
// longer associated with the job, in 100-nanosecond ticks."
|
||||||
let user: i64 = job_object_info.TotalUserTime / HUNDRED_NS_PER_MS;
|
let user_time = Time::new::<nanosecond>((job_object_info.TotalUserTime as f64) * 100.0);
|
||||||
|
|
||||||
// The `TotalKernelTime` is "The total amount of kernel-mode execution time
|
// The `TotalKernelTime` is "The total amount of kernel-mode execution time
|
||||||
// for all active processes associated with the job, as well as all terminated
|
// for all active processes associated with the job, as well as all terminated
|
||||||
// processes no longer associated with the job, in 100-nanosecond ticks."
|
// processes no longer associated with the job, in 100-nanosecond ticks."
|
||||||
let kernel: i64 = job_object_info.TotalKernelTime / HUNDRED_NS_PER_MS;
|
let system_time =
|
||||||
(
|
Time::new::<nanosecond>((job_object_info.TotalKernelTime as f64) * 100.0);
|
||||||
Time::new::<microsecond>(user as f64),
|
(user_time, system_time, Information::zero())
|
||||||
Time::new::<microsecond>(kernel as f64),
|
|
||||||
Information::zero(),
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
(Time::zero(), Time::zero(), Information::zero())
|
(Time::zero(), Time::zero(), Information::zero())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user