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.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 24 de Jun. de 2016

0 votos

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 comentarios

Naveen
Naveen el 24 de Jun. de 2016
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 el 24 de Jun. de 2016
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()

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Preguntada:

el 24 de Jun. de 2016

Comentada:

el 24 de Jun. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by