@@ -88,7 +88,6 @@ use std::fs;
8888use std:: path:: Path ;
8989use std:: process;
9090use std:: sync:: Arc ;
91- use std:: thread:: ThreadId ;
9291use std:: time:: { Duration , Instant } ;
9392use std:: u32;
9493
@@ -149,10 +148,6 @@ const EVENT_FILTERS_BY_NAME: &[(&str, EventFilter)] = &[
149148 ( "query-keys" , EventFilter :: QUERY_KEYS ) ,
150149] ;
151150
152- fn thread_id_to_u32 ( tid : ThreadId ) -> u32 {
153- unsafe { std:: mem:: transmute :: < ThreadId , u64 > ( tid) as u32 }
154- }
155-
156151/// Something that uniquely identifies a query invocation.
157152pub struct QueryInvocationId ( pub u32 ) ;
158153
@@ -318,7 +313,7 @@ impl SelfProfilerRef {
318313 ) {
319314 drop ( self . exec ( event_filter, |profiler| {
320315 let event_id = StringId :: new_virtual ( query_invocation_id. 0 ) ;
321- let thread_id = thread_id_to_u32 ( std:: thread:: current ( ) . id ( ) ) ;
316+ let thread_id = std:: thread:: current ( ) . id ( ) . as_u64 ( ) as u32 ;
322317
323318 profiler. profiler . record_instant_event (
324319 event_kind ( profiler) ,
@@ -477,7 +472,7 @@ impl<'a> TimingGuard<'a> {
477472 event_kind : StringId ,
478473 event_id : EventId ,
479474 ) -> TimingGuard < ' a > {
480- let thread_id = thread_id_to_u32 ( std:: thread:: current ( ) . id ( ) ) ;
475+ let thread_id = std:: thread:: current ( ) . id ( ) . as_u64 ( ) as u32 ;
481476 let raw_profiler = & profiler. profiler ;
482477 let timing_guard =
483478 raw_profiler. start_recording_interval_event ( event_kind, event_id, thread_id) ;
0 commit comments