File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,6 +111,11 @@ pub fn bench_add_sample_vs_add2(c: &mut Criterion) {
111111 str : "" ,
112112 num: thread_id,
113113 num_unit: "" ,
114+ } , api:: Label {
115+ key: "thread name" ,
116+ str : "this thread" ,
117+ num: 0 ,
118+ num_unit: "" ,
114119 } ] ;
115120
116121 let frames2 = frames. map ( |f| {
@@ -128,6 +133,23 @@ pub fn bench_add_sample_vs_add2(c: &mut Criterion) {
128133 } ) ;
129134 let dict = profiling:: profiles:: collections:: Arc :: try_new ( dict) . unwrap ( ) ;
130135
136+ c. bench_function ( "profile_add_sample_timestamped_x1000" , |b| {
137+ b. iter ( || {
138+ let mut profile = profiling:: internal:: Profile :: try_new ( & sample_types, None ) . unwrap ( ) ;
139+ let ( locations, values) = make_stack_api ( frames. as_slice ( ) ) ;
140+ for i in 0 ..1000 {
141+ let sample = api:: Sample {
142+ locations : locations. clone ( ) ,
143+ values : & values,
144+ labels : labels_api. clone ( ) ,
145+ } ;
146+ let ts = std:: num:: NonZeroI64 :: new ( i + 1 ) ;
147+ black_box ( profile. try_add_sample ( sample, ts) ) . unwrap ( ) ;
148+ }
149+ black_box ( profile. only_for_testing_num_aggregated_samples ( ) )
150+ } )
151+ } ) ;
152+
131153 c. bench_function ( "profile_add_sample_frames_x1000" , |b| {
132154 b. iter ( || {
133155 let mut profile = profiling:: internal:: Profile :: try_new ( & sample_types, None ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments