@@ -6,7 +6,7 @@ let s:sourcing_event_type = 0
66let s: other_event_type = 1
77
88" 's:tfields' contains the time fields.
9- let s: tfields = [' elapsed' , ' self+sourced ' , ' self' , ' clock ' ]
9+ let s: tfields = [' start ' , ' elapsed' , ' self' , ' self+sourced ' , ' finish ' ]
1010
1111let s: col_names = [' event' , ' time' , ' percent' , ' plot' ]
1212let s: widths = {
@@ -292,17 +292,20 @@ function! s:Extract(file, options) abort
292292 else
293293 let l: occurrences [l: key ] = 1
294294 endif
295+ " 'finish' time is reported as 'clock' in --startuptime output.
295296 let l: item = {
296297 \ ' event' : l: event ,
297298 \ ' occurrence' : l: occurrences [l: key ],
298- \ ' clock ' : str2float (l: times [0 ]),
299+ \ ' finish ' : str2float (l: times [0 ]),
299300 \ ' type' : l: type
300301 \ }
301302 if l: type == # s: sourcing_event_type
302303 let l: item [' self+sourced' ] = str2float (l: times [1 ])
303304 let l: item .self = str2float (l: times [2 ])
305+ let l: item .start = l: item .finish - l: item [' self+sourced' ]
304306 else
305307 let l: item .elapsed = str2float (l: times [1 ])
308+ let l: item .start = l: item .finish - l: item .elapsed
306309 endif
307310 let l: types = []
308311 if a: options .sourcing_events
@@ -328,7 +331,7 @@ function! s:Startup(items) abort
328331 \ s: other_event_type : ' elapsed'
329332 \ }
330333 let l: key = l: lookup [l: last .type ]
331- call add (l: times , l: last .clock )
334+ call add (l: times , l: last .finish )
332335 endfor
333336 let l: mean = s: Mean (l: times )
334337 let l: std = s: StandardDeviation (l: times , 1 , l: mean )
@@ -375,8 +378,8 @@ function! s:Consolidate(items) abort
375378 endfor
376379 endfor
377380 let l: Compare = {i1, i2 - >
378- \ i1.clock .mean == # i2.clock .mean
379- \ ? 0 : (i1.clock .mean <# i2.clock .mean ? -1 : 1 )}
381+ \ i1.start .mean == # i2.start .mean
382+ \ ? 0 : (i1.start .mean <# i2.start .mean ? -1 : 1 )}
380383 call sort (l: result , l: Compare )
381384 return l: result
382385endfunction
0 commit comments