The csv file attached below it produced from this code particularly by from s:results list of strings.
I import it into excel and then do a sort from max to min spent time by third column.
I would do the same from this vimscript below on in order to sort by numeric float Total time column
fun! helper#ybereportstats_timebyfunc(list) "{{{
"2. Total time by function
"
let totaltimelist = filter(copy(a:list), 'v:val =~ "TOTAL"')
let pattime = '\(\d\+\:\d\+:\d\+\.\d\+\)'
let patfunc = '\(\S\+()\)'
let pattotaltime = '\(\d\+\(,\d\+\)\{0,1}\)'
let linepat = '^.\{-}'.pattime.'.\{-}'.patfunc.'.\{-}'.pattotaltime.'.\{-}$'
let listtotaltimespent = map(copy(totaltimelist)[0:s:nEch], 'substitute(v:val, linepat, "\\2@\\3@\\1", "")')
" echomsg string(listtotaltimespent)
" return
for value in listtotaltimespent
" k : class/func name
" v : total time for the call..
" t : ..at time
" try
let [k,v,t] = split(value,'@')
" catch /.*/
" echomsg 'error ' . string(value)
" endtry
if !has_key(s:dict,k)
let s:dict[k] = { 'values' : [{'totaltime':v, 'time':t}] }
else
call extend(s:dict[k].values, [{'totaltime':v, 'time':t}])
endif
endfor
" echo s:dict
"
" 2. build results
"
let s:results = [join(["Func","Nb Occs", "Total time (ms)","Indicateur (ms/ech)"],s:sep)]
for funclass in keys(s:dict)
" Sum up total time for N occurs
let nOccur = len(s:dict[funclass].values)
" Sum up total time for N occurs
let sum=0.0
for time in s:dict[funclass].values
" echomsg time.totaltime
let sum+=str2float(substitute(time.totaltime, ',', '.', 'g'))
endfor
" let sumstr = tr(printf("%s",sum),'.',',')
let sumstr = printf("%s",sum)
let indicateur=printf("%s",sum/nOccur)
call extend(s:results, [funclass.s:sep.string(nOccur).s:sep.sumstr.s:sep.indicateur])
endfor
" echomsg string(s:results)
endfunction "}}}