mirror of
https://github.com/netbirdio/IronRDP.git
synced 2026-05-22 18:43:12 -07:00
fix(server)!: remove time_warn! from the public API (#773)
This is intended to be an internal macro.
This commit is contained in:
@@ -12,7 +12,8 @@ use ironrdp_pdu::surface_commands::{ExtendedBitmapDataPdu, SurfaceBitsPdu, Surfa
|
||||
use self::bitmap::BitmapEncoder;
|
||||
use self::rfx::RfxEncoder;
|
||||
use super::BitmapUpdate;
|
||||
use crate::{time_warn, ColorPointer, DisplayUpdate, Framebuffer, RGBAPointer};
|
||||
use crate::macros::time_warn;
|
||||
use crate::{ColorPointer, DisplayUpdate, Framebuffer, RGBAPointer};
|
||||
|
||||
mod bitmap;
|
||||
mod fast_path;
|
||||
|
||||
@@ -7,6 +7,9 @@ pub use {tokio, tokio_rustls};
|
||||
#[macro_use]
|
||||
extern crate tracing;
|
||||
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
|
||||
mod builder;
|
||||
mod capabilities;
|
||||
mod clipboard;
|
||||
@@ -34,27 +37,3 @@ pub mod bench {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! time_warn {
|
||||
($context:expr, $threshold_ms:expr, $op:expr) => {{
|
||||
#[cold]
|
||||
fn warn_log(context: &str, duration: u128) {
|
||||
use ::core::sync::atomic::AtomicUsize;
|
||||
|
||||
static COUNT: AtomicUsize = AtomicUsize::new(0);
|
||||
let current_count = COUNT.fetch_add(1, ::core::sync::atomic::Ordering::Relaxed);
|
||||
if current_count < 50 || current_count % 100 == 0 {
|
||||
::tracing::warn!("{context} took {duration} ms! (count: {current_count})");
|
||||
}
|
||||
}
|
||||
|
||||
let start = std::time::Instant::now();
|
||||
let result = $op;
|
||||
let duration = start.elapsed().as_millis();
|
||||
if duration > $threshold_ms {
|
||||
warn_log($context, duration);
|
||||
}
|
||||
result
|
||||
}};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
macro_rules! time_warn {
|
||||
($context:expr, $threshold_ms:expr, $op:expr) => {{
|
||||
#[cold]
|
||||
fn warn_log(context: &str, duration: u128) {
|
||||
use ::core::sync::atomic::AtomicUsize;
|
||||
|
||||
static COUNT: AtomicUsize = AtomicUsize::new(0);
|
||||
let current_count = COUNT.fetch_add(1, ::core::sync::atomic::Ordering::Relaxed);
|
||||
if current_count < 50 || current_count % 100 == 0 {
|
||||
::tracing::warn!("{context} took {duration} ms! (count: {current_count})");
|
||||
}
|
||||
}
|
||||
|
||||
let start = std::time::Instant::now();
|
||||
let result = $op;
|
||||
let duration = start.elapsed().as_millis();
|
||||
if duration > $threshold_ms {
|
||||
warn_log($context, duration);
|
||||
}
|
||||
result
|
||||
}};
|
||||
}
|
||||
|
||||
pub(crate) use time_warn;
|
||||
Reference in New Issue
Block a user