@@ -15,11 +15,11 @@ pub struct ProfilerFiles {
1515}
1616
1717impl ProfilerFiles {
18- pub fn new ( path_stem : & Path ) -> ProfilerFiles {
18+ pub fn new < P : AsRef < Path > > ( path_stem : P ) -> ProfilerFiles {
1919 ProfilerFiles {
20- events_file : path_stem. with_extension ( "events" ) ,
21- string_data_file : path_stem. with_extension ( "string_data" ) ,
22- string_index_file : path_stem. with_extension ( "string_index" ) ,
20+ events_file : path_stem. as_ref ( ) . with_extension ( "events" ) ,
21+ string_data_file : path_stem. as_ref ( ) . with_extension ( "string_data" ) ,
22+ string_index_file : path_stem. as_ref ( ) . with_extension ( "string_index" ) ,
2323 }
2424 }
2525}
@@ -31,8 +31,9 @@ pub struct Profiler<S: SerializationSink> {
3131}
3232
3333impl < S : SerializationSink > Profiler < S > {
34- pub fn new ( path_stem : & Path ) -> Result < Profiler < S > , Box < dyn Error > > {
35- let paths = ProfilerFiles :: new ( path_stem) ;
34+ pub fn new < P : AsRef < Path > > ( path_stem : P )
35+ -> Result < Profiler < S > , Box < dyn Error + Send + Sync > > {
36+ let paths = ProfilerFiles :: new ( path_stem. as_ref ( ) ) ;
3637 let event_sink = Arc :: new ( S :: from_path ( & paths. events_file ) ?) ;
3738
3839 // The first thing in every file we generate must be the file header.
@@ -126,8 +127,7 @@ impl<S: SerializationSink> Profiler<S> {
126127 }
127128
128129 fn nanos_since_start ( & self ) -> u64 {
129- let duration_since_start = self . start_time . elapsed ( ) ;
130- duration_since_start. as_secs ( ) * 1_000_000_000 + duration_since_start. subsec_nanos ( ) as u64
130+ self . start_time . elapsed ( ) . as_nanos ( ) as _
131131 }
132132}
133133
0 commit comments