File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,23 @@ pub fn bench_add_sample_vs_add2(c: &mut Criterion) {
128128 } ) ;
129129 let dict = profiling:: profiles:: collections:: Arc :: try_new ( dict) . unwrap ( ) ;
130130
131+ c. bench_function ( "profile_add_sample_timestamped_x1000" , |b| {
132+ b. iter ( || {
133+ let mut profile = profiling:: internal:: Profile :: try_new ( & sample_types, None ) . unwrap ( ) ;
134+ let ( locations, values) = make_stack_api ( frames. as_slice ( ) ) ;
135+ for i in 0 ..1000 {
136+ let sample = api:: Sample {
137+ locations : locations. clone ( ) ,
138+ values : & values,
139+ labels : labels_api. clone ( ) ,
140+ } ;
141+ let ts = std:: num:: NonZeroI64 :: new ( i + 1 ) ;
142+ black_box ( profile. try_add_sample ( sample, ts) ) . unwrap ( ) ;
143+ }
144+ black_box ( profile. only_for_testing_num_aggregated_samples ( ) )
145+ } )
146+ } ) ;
147+
131148 c. bench_function ( "profile_add_sample_frames_x1000" , |b| {
132149 b. iter ( || {
133150 let mut profile = profiling:: internal:: Profile :: try_new ( & sample_types, None ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments