How can I merge two profiler results?

2 次查看(过去 30 天)
I want to find out why two similar processes have very different runtimes.
To do this, I need to be able to merge the two Profiler tables (Function Name, Calls, Total Time, Self Time) by Function Name, and compute the time difference for each function name.
Can MATLAB do this?
Thank you.
  1 个评论
Leigh Sneddon
Leigh Sneddon 2022-2-20
Alternatively, can MATLAB save the Profiler output table (Function Name, Calls, Total Time, Self Time) to a text or spreadsheet file?
Thank you.

请先登录,再进行评论。

采纳的回答

Seth Furman
Seth Furman 2022-2-28
profile on; categorical(1:10); profile off;
p = profile("info");
struct2table(p.FunctionTable)
ans = 20×12 table
CompleteName FunctionName FileName Type Children Parents ExecutedLines IsRecursive TotalRecursiveTime PartialData NumCalls TotalTime ___________________________________________________________________________________________________________________________ ___________________________________________________ ___________________________________________________________________________________________________________ _____________________ _____________ ____________ _____________ ___________ __________________ ___________ ________ _________ {'/MATLAB/toolbox/matlab/datatypes/categorical/@categorical/categorical.m>categorical.categorical' } {'categorical.categorical>categorical.categorical'} {'/MATLAB/toolbox/matlab/datatypes/categorical/@categorical/categorical.m' } {'M-method' } {10×1 struct} {1×1 struct} {62×3 double} false 0 false 1 0.021023 {'/MATLAB/toolbox/matlab/datatypes/shared/matlab_datatypes/+matlab/+internal/+datatypes/parseArgs.m>parseArgs' } {'parseArgs' } {'/MATLAB/toolbox/matlab/datatypes/shared/matlab_datatypes/+matlab/+internal/+datatypes/parseArgs.m' } {'M-function' } { 0×1 struct} {1×1 struct} {21×3 double} false 0 false 1 0.002496 {'/MATLAB/toolbox/matlab/datatypes/shared/matlab_datatypes/+matlab/+internal/+datatypes/validateLogical.m>validateLogical'} {'validateLogical' } {'/MATLAB/toolbox/matlab/datatypes/shared/matlab_datatypes/+matlab/+internal/+datatypes/validateLogical.m'} {'M-function' } { 0×1 struct} {1×1 struct} { 3×3 double} false 0 false 2 0.000274 {'/MATLAB/toolbox/matlab/datafun/+matlab/+internal/+math/ismissingKernel.m>ismissingKernel' } {'ismissingKernel' } {'/MATLAB/toolbox/matlab/datafun/+matlab/+internal/+math/ismissingKernel.m' } {'M-function' } { 2×1 struct} {1×1 struct} { 7×3 double} false 0 false 1 0.001396 {'/MATLAB/toolbox/matlab/datatypes/shared/matlab_datatypes/+matlab/+internal/+datatypes/istabular.m>istabular' } {'istabular' } {'/MATLAB/toolbox/matlab/datatypes/shared/matlab_datatypes/+matlab/+internal/+datatypes/istabular.m' } {'M-function' } { 0×1 struct} {2×1 struct} { 2×3 double} false 0 false 2 0.000312 {'/MATLAB/toolbox/matlab/ops/unique.m>unique' } {'unique' } {'/MATLAB/toolbox/matlab/ops/unique.m' } {'M-function' } { 1×1 struct} {1×1 struct} {12×3 double} false 0 false 1 0.002708 {'/MATLAB/toolbox/matlab/ops/unique.m>uniqueR2012a' } {'unique>uniqueR2012a' } {'/MATLAB/toolbox/matlab/ops/unique.m' } {'M-subfunction' } { 0×1 struct} {1×1 struct} { 8×3 double} false 0 false 1 0.001403 {'/MATLAB/toolbox/matlab/datafun/+matlab/+internal/+math/ismissingKernel.m>ismissingKernel/arraySwitch' } {'ismissingKernel>arraySwitch' } {'/MATLAB/toolbox/matlab/datafun/+matlab/+internal/+math/ismissingKernel.m' } {'M-nested-function'} { 0×1 struct} {1×1 struct} { 6×3 double} false 0 false 1 0.000388 {'/MATLAB/toolbox/matlab/datafun/ismissing.m>ismissing' } {'ismissing' } {'/MATLAB/toolbox/matlab/datafun/ismissing.m' } {'M-function' } { 1×1 struct} {1×1 struct} { 3×3 double} false 0 false 1 0.001816 {'/MATLAB/toolbox/matlab/datatypes/categorical/@categorical/categorical.m>removeUtil' } {'categorical.categorical>removeUtil' } {'/MATLAB/toolbox/matlab/datatypes/categorical/@categorical/categorical.m' } {'M-subfunction' } { 0×1 struct} {1×1 struct} { 3×3 double} false 0 false 1 3.6e-05 {'/MATLAB/toolbox/matlab/strfun/num2str.m>num2str' } {'num2str' } {'/MATLAB/toolbox/matlab/strfun/num2str.m' } {'M-function' } { 1×1 struct} {1×1 struct} {32×3 double} false 0 false 1 0.006679 {'/MATLAB/toolbox/matlab/strfun/int2str.m>int2str' } {'int2str' } {'/MATLAB/toolbox/matlab/strfun/int2str.m' } {'M-function' } { 0×1 struct} {1×1 struct} {23×3 double} false 0 false 1 0.002604 {'/MATLAB/toolbox/matlab/strfun/cellstr.m>cellstr' } {'cellstr' } {'/MATLAB/toolbox/matlab/strfun/cellstr.m' } {'M-function' } { 0×1 struct} {1×1 struct} {12×3 double} false 0 false 1 0.001264 {'/MATLAB/toolbox/matlab/ops/@cell/unique.m>unique' } {'cell.unique' } {'/MATLAB/toolbox/matlab/ops/@cell/unique.m' } {'M-function' } { 0×1 struct} {1×1 struct} {10×3 double} false 0 false 1 0.000905 {'/MATLAB/toolbox/matlab/datatypes/categorical/@categorical/categorical.m>categorical.castCodes' } {'categorical.categorical>categorical.castCodes' } {'/MATLAB/toolbox/matlab/datatypes/categorical/@categorical/categorical.m' } {'M-method' } { 0×1 struct} {1×1 struct} { 4×3 double} false 0 false 1 7.1e-05 {'/tmp/Editor_ymhri/LiveEditorEvaluationHelperEeditorId.m>LiveEditorEvaluationHelperEeditorId' } {'LiveEditorEvaluationHelperEeditorId' } {'/tmp/Editor_ymhri/LiveEditorEvaluationHelperEeditorId.m' } {'M-script' } { 1×1 struct} {1×1 struct} { 0×3 double} false 0 false 1 0.022783

更多回答(0 个)

产品


版本

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by