Measure the time spent by a function

3 ビュー (過去 30 日間)
Lask
Lask 2017 年 10 月 17 日
コメント済み: Lask 2017 年 10 月 18 日
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.

回答 (2 件)

KSSV
KSSV 2017 年 10 月 18 日
You type tic and toc inside your myfunction.

Stephen23
Stephen23 2017 年 10 月 18 日
編集済み: Stephen23 2017 年 10 月 18 日
  3 件のコメント
Jan
Jan 2017 年 10 月 18 日
@E. Valero: The time for "calling" this function does mean the time, which is spent inside the function.
Lask
Lask 2017 年 10 月 18 日
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

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

カテゴリ

Help Center および File ExchangeData Acquisition Toolbox Supported Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by