SEP: advanced function/profiling in Scilab 6

Abstract

Scilab 6 introduced “coverage” functions and removed the legacy “profiling” functions, this SEP clarify the overall usage of such functionality and propose some extension to the Scilab 6.0.x functions: covStart, covMerge, covStop and covWrite. “coverage” did not aim to replace the “profiling” functionality but as both terms are related to the same “dynamic code analysis” area this led to some confusion; in this SEP, we will clarify the expected behaviors and describe a way to implement both “coverage” (the degree to which the source code is executed on a particular execution) and “profiling” (the frequency of each line of the source code) on top of the execution counters used to track execution time in Scilab 6.

Requirements

The initial idea is to have more information on a Scilab specific execution. Without any dedicated support, the user is left to guess where the code spent most of its time. “profiling” an execution should give insights on the execution by giving timing information back to the user as Scilab values and providing an easy way to visualize these timings. A specific analysis could also be written using Scilab to generate dedicated reports. “coverage” of an execution is such a dedicated report; it writes an HTML report of an execution in the form of a code line coverage.

The functions dedicated to the coverage are preserved as in 6.0.x and could be mixed with the profiling ones. The following functions are added or reserved for profiling:

The following names are reserved for a future implementation:

/!\ comparing to the Scilab 5 implementation, the functionalities are all prefixed with a profile name to clarify the topic.

The following bugs have been entered on Bugzilla to track similar or related problems/wishlist:

Mailing list threads

Other software

Examples

   1 // Function to be profiled
   2 function x=foo(n)
   3   if n > 0 then
   4     x = 0;
   5     for k = 1:n
   6       s = svd(rand(n, n));
   7       x = x + s(1);
   8     end
   9   else
  10     x = [];
  11   end
  12 endfunction
  13 
  14 // Enables the profiling of the function
  15 profileEnable(foo)
  16 
  17 // Executes the function
  18 foo(200);
  19 
  20 // Returns the function profiling results
  21 prof = profileGetInfo();


CategorySep

public: SEP profiling in Scilab 6.1 (last edited 2018-12-11 14:56:52 by mal35-2-82-228-177-212)