pro mg_profiler_report, filename=filename, csv=csv, html=html
compile_opt strictarr
profiler, /report, data=data, output=output
ind = sort(-data.time)
data = data[ind]
output = output[ind]
if (n_elements(filename) gt 0L) then begin
openw, lun, filename, /get_lun
endif else begin
lun = -1L
endelse
case 1 of
keyword_set(csv): printf, lun, data, format='(%"%s, %d, %f, %f, %d")'
keyword_set(html): begin
template_filename = filepath('profiler.tt', root=mg_src_root())
template = obj_new('MGffTemplate', template_filename)
template->process, data, lun=lun
obj_destroy, template
end
else: printf, lun, output
endcase
if (n_elements(filename) gt 0L) then free_lun, lun
end