1
1
use crate :: timestamp:: Timestamp ;
2
2
use crate :: { Event , ProfilingData } ;
3
- use measureme:: { EventIdBuilder , Profiler , SerializationSink , StringId } ;
3
+ use measureme:: { EventId , EventIdBuilder , Profiler , SerializationSink , StringId } ;
4
4
use rustc_hash:: FxHashMap ;
5
5
use std:: borrow:: Cow ;
6
6
use std:: default:: Default ;
@@ -26,11 +26,7 @@ struct ExpectedEvent {
26
26
}
27
27
28
28
impl ExpectedEvent {
29
- fn new (
30
- kind : & ' static str ,
31
- label : & ' static str ,
32
- args : & [ & ' static str ]
33
- ) -> ExpectedEvent {
29
+ fn new ( kind : & ' static str , label : & ' static str , args : & [ & ' static str ] ) -> ExpectedEvent {
34
30
ExpectedEvent {
35
31
kind : Cow :: from ( kind) ,
36
32
label : Cow :: from ( label) ,
@@ -47,21 +43,20 @@ fn generate_profiling_data<S: SerializationSink>(
47
43
) -> Vec < Event < ' static > > {
48
44
let profiler = Arc :: new ( Profiler :: < S > :: new ( Path :: new ( filestem) ) . unwrap ( ) ) ;
49
45
50
- let event_id_virtual = StringId :: new_virtual ( 42 ) ;
51
-
46
+ let event_id_virtual = EventId :: from_label ( StringId :: new_virtual ( 42 ) ) ;
52
47
let event_id_builder = EventIdBuilder :: new ( & profiler) ;
53
48
54
- let event_ids = vec ! [
49
+ let event_ids: Vec < ( StringId , EventId ) > = vec ! [
55
50
(
56
51
profiler. alloc_string( "Generic" ) ,
57
- profiler. alloc_string( "SomeGenericActivity" ) ,
52
+ EventId :: from_label ( profiler. alloc_string( "SomeGenericActivity" ) ) ,
58
53
) ,
59
54
( profiler. alloc_string( "Query" ) , event_id_virtual) ,
60
55
(
61
56
profiler. alloc_string( "QueryWithArg" ) ,
62
57
event_id_builder. from_label_and_arg(
63
58
profiler. alloc_string( "AQueryWithArg" ) ,
64
- profiler. alloc_string( "some_arg" )
59
+ profiler. alloc_string( "some_arg" ) ,
65
60
) ,
66
61
) ,
67
62
] ;
@@ -104,7 +99,7 @@ fn generate_profiling_data<S: SerializationSink>(
104
99
// An example of allocating the string contents of an event id that has
105
100
// already been used
106
101
profiler. map_virtual_to_concrete_string (
107
- event_id_virtual,
102
+ event_id_virtual. to_string_id ( ) ,
108
103
profiler. alloc_string ( "SomeQuery" )
109
104
) ;
110
105
@@ -195,7 +190,7 @@ fn pseudo_invocation<S: SerializationSink>(
195
190
random : usize ,
196
191
thread_id : u32 ,
197
192
recursions_left : usize ,
198
- event_ids : & [ ( StringId , StringId ) ] ,
193
+ event_ids : & [ ( StringId , EventId ) ] ,
199
194
expected_events_templates : & [ ExpectedEvent ] ,
200
195
expected_events : & mut Vec < Event < ' static > > ,
201
196
) {
0 commit comments