summaryrefslogtreecommitdiff
path: root/modules/functions/macros/profile.sci
blob: d161fa71206a82bf5e05beb37676950ca3d500f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2008 - INRIA
// Copyright (C) 2013 - Samuel GOUGEON : bug #13146 fixed
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt

function count = profile(fun)
    if argn(2) < 1 then
        error(sprintf(_("%s: Wrong number of input argument(s): %d expected.\n"), "profile", 1));
    end
    if type(fun)==13 then
        lst = macr2lst(fun)
    else
        lst = fun
    end
    i = 5
    if lst(4)(1)=="31"
        i = 6
    end
    if lst(i)(1)<>"25" then
        error(msprintf(gettext("%s: The function has not been built for profiling"), "profile"))
    end
    count = get_profile(lst,4)
    count = count(1:$-1,:)
    count(:,2) = count(:,2)/1000000
endfunction