When I 'Run and time' a function, and look at the bottom of the profile summary, it says "Self time is the time spent in a function excluding the time spent in its child functions. Self time also includes overhead resulting from the process of profiling. I can have a vague idea as to what it is based on context (i.e. subfunctions), but would like a more rigorous definition of what it is.

 採用された回答

Walter Roberson
Walter Roberson 2016 年 6 月 24 日

0 投票

Child functions in this context is any routine that is called. For example,
function test
for K = 1 : 300000
sort(rand(1,K));
end
then "self-time" would be the total time spent executing test minus the time spent executing rand and sort

2 件のコメント

Naveen
Naveen 2016 年 6 月 24 日
So for example, the following code, when 'run and timed'
A = zeros(length(C) - end_info,n_mnr);
for i =start_row:length(C)
A(i - end_info,:) = str2num(C{i});
end
produces this as one of the lines in the profile summary.
Function Name .......Calls ...... Total Time .......Self Time*
str2num............1048578 ....... 95.887s ........... 22.986s
What would be the child functions for str2num then? Does it refer to functions within the pre-programmed str2num?
Walter Roberson
Walter Roberson 2016 年 6 月 24 日
Yes, str2num() calls several functions, with the major work being done by eval(), which is relatively inefficient.
Note: if you are concerned about performance you should look at str2double() or sscanf()

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by