@@ -159,33 +159,47 @@ pub fn perform_analysis(data: ProfilingData) -> Results {
159
159
thread. stack . pop ( ) ;
160
160
}
161
161
162
+ let current_event_duration = current_event. duration ( ) . unwrap ( ) ;
163
+
162
164
// If there is something on the stack, subtract the current
163
165
// interval from it.
164
166
if let Some ( current_top) = thread. stack . last ( ) {
165
167
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
+ }
167
181
} ) ;
168
182
}
169
183
170
184
// Update counters for the current event
171
185
match & current_event. event_kind [ ..] {
172
186
QUERY_EVENT_KIND | GENERIC_ACTIVITY_EVENT_KIND => {
173
187
record_event_data ( & current_event. label , & |data| {
174
- data. self_time += current_event . duration ( ) . unwrap ( ) ;
188
+ data. self_time += current_event_duration ;
175
189
data. number_of_cache_misses += 1 ;
176
190
data. invocation_count += 1 ;
177
191
} ) ;
178
192
}
179
193
180
194
QUERY_BLOCKED_EVENT_KIND => {
181
195
record_event_data ( & current_event. label , & |data| {
182
- data. blocked_time += current_event . duration ( ) . unwrap ( ) ;
196
+ data. blocked_time += current_event_duration ;
183
197
} ) ;
184
198
}
185
199
186
200
INCREMENTAL_LOAD_RESULT_EVENT_KIND => {
187
201
record_event_data ( & current_event. label , & |data| {
188
- data. incremental_load_time += current_event . duration ( ) . unwrap ( ) ;
202
+ data. incremental_load_time += current_event_duration ;
189
203
} ) ;
190
204
}
191
205
0 commit comments