File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
crates/ironrdp-server/src Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -28,3 +28,16 @@ pub use handler::*;
28
28
pub use helper:: * ;
29
29
pub use server:: * ;
30
30
pub use sound:: * ;
31
+
32
+ #[ macro_export]
33
+ macro_rules! time_warn {
34
+ ( $context: expr, $threshold: expr, $op: expr) => { {
35
+ let start = std:: time:: Instant :: now( ) ;
36
+ let result = $op;
37
+ let duration = start. elapsed( ) . as_millis( ) ;
38
+ if duration > $threshold {
39
+ :: tracing:: warn!( "{} took {} ms!" , $context, duration) ;
40
+ }
41
+ result
42
+ } } ;
43
+ }
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ use crate::clipboard::CliprdrServerFactory;
32
32
use crate :: display:: { DisplayUpdate , RdpServerDisplay } ;
33
33
use crate :: encoder:: UpdateEncoder ;
34
34
use crate :: handler:: RdpServerInputHandler ;
35
- use crate :: { builder, capabilities, SoundServerFactory } ;
35
+ use crate :: { builder, capabilities, time_warn , SoundServerFactory } ;
36
36
37
37
#[ derive( Clone ) ]
38
38
pub struct RdpServerOptions {
@@ -417,7 +417,7 @@ impl RdpServer {
417
417
let mut fragmenter = match update {
418
418
DisplayUpdate :: Bitmap ( bitmap) => {
419
419
let ( enc, res) = task:: spawn_blocking ( move || {
420
- let res = encoder. bitmap ( bitmap) . map ( |r| r. into_owned ( ) ) ;
420
+ let res = time_warn ! ( "Encoding bitmap" , 10 , encoder. bitmap( bitmap) . map( |r| r. into_owned( ) ) ) ;
421
421
( encoder, res)
422
422
} )
423
423
. await ?;
You can’t perform that action at this time.
0 commit comments