@@ -159,33 +159,47 @@ pub fn perform_analysis(data: ProfilingData) -> Results {
159159 thread. stack . pop ( ) ;
160160 }
161161
162+ let current_event_duration = current_event. duration ( ) . unwrap ( ) ;
163+
162164 // If there is something on the stack, subtract the current
163165 // interval from it.
164166 if let Some ( current_top) = thread. stack . last ( ) {
165167 record_event_data ( & current_top. label , & |data| {
166- data. self_time -= current_event. duration ( ) . unwrap ( ) ;
168+ match & current_top. event_kind [ ..] {
169+ QUERY_EVENT_KIND | GENERIC_ACTIVITY_EVENT_KIND => {
170+ data. self_time -= current_event_duration;
171+ }
172+ INCREMENTAL_LOAD_RESULT_EVENT_KIND => {
173+ data. incremental_load_time -= current_event_duration;
174+ }
175+ _ => {
176+ eprintln ! ( "Unexpectedly enountered event `{:?}`, \
177+ while top of stack was `{:?}`. Ignoring.",
178+ current_event, current_top) ;
179+ }
180+ }
167181 } ) ;
168182 }
169183
170184 // Update counters for the current event
171185 match & current_event. event_kind [ ..] {
172186 QUERY_EVENT_KIND | GENERIC_ACTIVITY_EVENT_KIND => {
173187 record_event_data ( & current_event. label , & |data| {
174- data. self_time += current_event . duration ( ) . unwrap ( ) ;
188+ data. self_time += current_event_duration ;
175189 data. number_of_cache_misses += 1 ;
176190 data. invocation_count += 1 ;
177191 } ) ;
178192 }
179193
180194 QUERY_BLOCKED_EVENT_KIND => {
181195 record_event_data ( & current_event. label , & |data| {
182- data. blocked_time += current_event . duration ( ) . unwrap ( ) ;
196+ data. blocked_time += current_event_duration ;
183197 } ) ;
184198 }
185199
186200 INCREMENTAL_LOAD_RESULT_EVENT_KIND => {
187201 record_event_data ( & current_event. label , & |data| {
188- data. incremental_load_time += current_event . duration ( ) . unwrap ( ) ;
202+ data. incremental_load_time += current_event_duration ;
189203 } ) ;
190204 }
191205
0 commit comments