@@ -99,10 +99,12 @@ use parking_lot::RwLock;
9999
100100/// MmapSerializatioSink is faster on macOS and Linux
101101/// but FileSerializationSink is faster on Windows
102- #[ cfg( not( windows) ) ]
102+ #[ cfg( all ( not( windows) , not ( target_arch= "wasm32" ) ) ) ]
103103type SerializationSink = measureme:: MmapSerializationSink ;
104- #[ cfg( windows) ]
104+ #[ cfg( all ( windows, not ( target_arch= "wasm32" ) ) ) ]
105105type SerializationSink = measureme:: FileSerializationSink ;
106+ #[ cfg( target_arch="wasm32" ) ]
107+ type SerializationSink = measureme:: ByteVecSink ;
106108
107109type Profiler = measureme:: Profiler < SerializationSink > ;
108110
@@ -602,7 +604,7 @@ pub fn duration_to_secs_str(dur: std::time::Duration) -> String {
602604}
603605
604606// Memory reporting
605- #[ cfg( unix) ]
607+ #[ cfg( all ( unix, not ( target_arch= "wasm32" ) ) ) ]
606608fn get_resident ( ) -> Option < usize > {
607609 let field = 1 ;
608610 let contents = fs:: read ( "/proc/self/statm" ) . ok ( ) ?;
@@ -612,7 +614,7 @@ fn get_resident() -> Option<usize> {
612614 Some ( npages * 4096 )
613615}
614616
615- #[ cfg( windows) ]
617+ #[ cfg( all ( windows, not ( target_arch= "wasm32" ) ) ) ]
616618fn get_resident ( ) -> Option < usize > {
617619 use std:: mem:: { self , MaybeUninit } ;
618620 use winapi:: shared:: minwindef:: DWORD ;
@@ -630,3 +632,8 @@ fn get_resident() -> Option<usize> {
630632 }
631633 }
632634}
635+
636+ #[ cfg( target_arch="wasm32" ) ]
637+ fn get_resident ( ) -> Option < usize > {
638+ None
639+ }
0 commit comments