@@ -99,10 +99,12 @@ use parking_lot::RwLock;
99
99
100
100
/// MmapSerializatioSink is faster on macOS and Linux
101
101
/// but FileSerializationSink is faster on Windows
102
- #[ cfg( not( windows) ) ]
102
+ #[ cfg( all ( not( windows) , not ( target_arch= "wasm32" ) ) ) ]
103
103
type SerializationSink = measureme:: MmapSerializationSink ;
104
- #[ cfg( windows) ]
104
+ #[ cfg( all ( windows, not ( target_arch= "wasm32" ) ) ) ]
105
105
type SerializationSink = measureme:: FileSerializationSink ;
106
+ #[ cfg( target_arch="wasm32" ) ]
107
+ type SerializationSink = measureme:: ByteVecSink ;
106
108
107
109
type Profiler = measureme:: Profiler < SerializationSink > ;
108
110
@@ -602,7 +604,7 @@ pub fn duration_to_secs_str(dur: std::time::Duration) -> String {
602
604
}
603
605
604
606
// Memory reporting
605
- #[ cfg( unix) ]
607
+ #[ cfg( all ( unix, not ( target_arch= "wasm32" ) ) ) ]
606
608
fn get_resident ( ) -> Option < usize > {
607
609
let field = 1 ;
608
610
let contents = fs:: read ( "/proc/self/statm" ) . ok ( ) ?;
@@ -612,7 +614,7 @@ fn get_resident() -> Option<usize> {
612
614
Some ( npages * 4096 )
613
615
}
614
616
615
- #[ cfg( windows) ]
617
+ #[ cfg( all ( windows, not ( target_arch= "wasm32" ) ) ) ]
616
618
fn get_resident ( ) -> Option < usize > {
617
619
use std:: mem:: { self , MaybeUninit } ;
618
620
use winapi:: shared:: minwindef:: DWORD ;
@@ -630,3 +632,8 @@ fn get_resident() -> Option<usize> {
630
632
}
631
633
}
632
634
}
635
+
636
+ #[ cfg( target_arch="wasm32" ) ]
637
+ fn get_resident ( ) -> Option < usize > {
638
+ None
639
+ }
0 commit comments