Measure the time spent by a function

Hi everyone,
I have programmed a function in Matlab which calls a second function from a DLL which is programmed in C. For instance:
Matlab function: function A = myfunction{calls myDLLfunction}
DLL function in .dll file: function = myDLLfunction{does something}
I want to measure the time spent by myDLLfunction execution from Matlab. I tried the following:
tic
A = myfunction(calls myDLLfunction)
toc
but obviously, this only measures the time spent by myfunction calling myDLLfunction, not the actual time spent by myDLLfunction once it is called.
Any help would be appreciated.

Respuestas (2)

KSSV
KSSV el 18 de Oct. de 2017

0 votos

You type tic and toc inside your myfunction.
Stephen23
Stephen23 el 18 de Oct. de 2017
Editada: Stephen23 el 18 de Oct. de 2017

0 votos

3 comentarios

Lask
Lask el 18 de Oct. de 2017
Hey Stephen, thanks for answering.
The profiler gives information about the MATLAB functions. So, If I call a function from a DLL with myfunction, the profiler measures only the callback time, not the time spent by the function in the DLL. You can see this in the next pic:
As you can see, ret = callib(...) calls a funcion which is defined in a DLL, so the Line Number 90 only gives information about the time spent in calling that function, not the actual time spent during that function execution.
Best regards
Jan
Jan el 18 de Oct. de 2017
@E. Valero: The time for "calling" this function does mean the time, which is spent inside the function.
Lask
Lask el 18 de Oct. de 2017
Hey Jan,
so even if the called function is in a DLL external to MATLAB, the time spent by calllib includes the execution time of that function?
Thanks

Iniciar sesión para comentar.

Categorías

Más información sobre Data Acquisition Toolbox Supported Hardware en Centro de ayuda y File Exchange.

Preguntada:

el 17 de Oct. de 2017

Comentada:

el 18 de Oct. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by