mirror of
https://github.com/Chaoscaot/schemsearch.git
synced 2025-11-30 22:57:06 +01:00
Enhance time! macro for conditional compilation
The `time!` macro now only logs execution time in debug mode, avoiding unnecessary overhead in release builds. Added `CommandQueueProperties` and `Context` imports to `schemsearch-ocl-matcher` for potential future functionality.
This commit is contained in:
@@ -37,11 +37,20 @@ pub struct Match {
|
|||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! time {
|
macro_rules! time {
|
||||||
($name:ident, $body:block) => {{
|
($name:ident, $body:block) => {
|
||||||
let start = std::time::Instant::now();
|
{
|
||||||
let result = $body;
|
#[cfg(debug_assertions)]
|
||||||
let duration = start.elapsed();
|
{
|
||||||
println!("{} took {:?}", stringify!($name), duration);
|
let start = std::time::Instant::now();
|
||||||
result
|
let result = $body;
|
||||||
}};
|
let duration = start.elapsed();
|
||||||
|
println!("{} took {:?}", stringify!($name), duration);
|
||||||
|
result
|
||||||
|
}
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
{
|
||||||
|
$body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use math::round::ceil;
|
use math::round::ceil;
|
||||||
use ocl::SpatialDims::Three;
|
use ocl::SpatialDims::Three;
|
||||||
use ocl::{core, Buffer, Image, MemFlags, ProQue};
|
use ocl::{core, Buffer, CommandQueueProperties, Context, Image, MemFlags, ProQue};
|
||||||
use schemsearch_common::{time, Match, SearchBehavior};
|
use schemsearch_common::{time, Match, SearchBehavior};
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
use std::time;
|
use std::time;
|
||||||
|
|||||||
Reference in New Issue
Block a user