@@ -88,7 +88,6 @@ use std::fs;
88
88
use std:: path:: Path ;
89
89
use std:: process;
90
90
use std:: sync:: Arc ;
91
- use std:: thread:: ThreadId ;
92
91
use std:: time:: { Duration , Instant } ;
93
92
use std:: u32;
94
93
@@ -149,10 +148,6 @@ const EVENT_FILTERS_BY_NAME: &[(&str, EventFilter)] = &[
149
148
( "query-keys" , EventFilter :: QUERY_KEYS ) ,
150
149
] ;
151
150
152
- fn thread_id_to_u32 ( tid : ThreadId ) -> u32 {
153
- unsafe { std:: mem:: transmute :: < ThreadId , u64 > ( tid) as u32 }
154
- }
155
-
156
151
/// Something that uniquely identifies a query invocation.
157
152
pub struct QueryInvocationId ( pub u32 ) ;
158
153
@@ -318,7 +313,7 @@ impl SelfProfilerRef {
318
313
) {
319
314
drop ( self . exec ( event_filter, |profiler| {
320
315
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 ;
322
317
323
318
profiler. profiler . record_instant_event (
324
319
event_kind ( profiler) ,
@@ -477,7 +472,7 @@ impl<'a> TimingGuard<'a> {
477
472
event_kind : StringId ,
478
473
event_id : EventId ,
479
474
) -> 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 ;
481
476
let raw_profiler = & profiler. profiler ;
482
477
let timing_guard =
483
478
raw_profiler. start_recording_interval_event ( event_kind, event_id, thread_id) ;
0 commit comments