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 Exchange에서 Data Type Conversion에 대해 자세히 알아보기

질문:

2016년 6월 24일

댓글:

2016년 6월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by