General information about instrumentation capabilities
profileEnable(function) profileDisable(function) prof = profileGetInfo()
A Scilab function.
The execution information of function.
These commands are used to profile a specific function within Scilab and get some execution information as Scilab values for further manipulation. Any Scilab function could be instrumented and function informations (static and after execution) are generated for each instrumented function independently. For more information on the prof value, see profileGetInfo.
The commands are used to setup and retrieve execution information. As the instrumentation information are accessible within Scilab you could define specific computation to report these numbers.
// Function to be profiled function x=foo(n) if n > 0 then x = 0; for k = 1:n s = svd(rand(n, n)); x = x + s(1); end else x = []; end endfunction // Enables the profiling of the function profileEnable(foo) // Executes the function foo(200); // Returns the function profiling results prof = profileGetInfo() // Disables the profiling of the function profileDisable(foo) | ![]() | ![]() |
profileEnable(assert_checkalmostequal) // instrument assert_checkalmostequal() assert_checkalmostequal(1, 1 + %eps) // execute the function prof = profileGetInfo() // retrieve execution information profileDisable(assert_checkalmostequal) // de-instrument assert_checkalmostequal() | ![]() | ![]() |
// instrument and execute as before profileEnable(assert_checkalmostequal); assert_checkalmostequal(1, 1 + %eps); assert_checkalmostequal(1, 1 + %eps, 2 * %eps); assert_checkalmostequal(1, 1 + %eps, %eps, %eps); prof = profileGetInfo(); profileDisable(assert_checkalmostequal); // retrieve the function text txt = mgetl(part(prof.FunctionTable.FileName(1), 1:($-3)) + "sci"); txt = txt(prof.FunctionTable.FirstLine(1):$); // sort per execution time and display the corresponding lines [B, k] = gsort(prof.LineCoverage(1)(:,2)); [string(k(1:5)) string(prof.LineCoverage(1)(k(1:5),2)), txt(k(1:5))] | ![]() | ![]() |