This is a static copy of a profile report

Home

functionhintsfunc (Calls: 7, Time: 0.013 s)
Generated 18-May-2021 16:05:26 using performance time.
function in file /usr/local/MATLAB/R2021a/toolbox/matlab/codetools/functionhintsfunc.m
Copy to new window for comparing multiple runs

Parents (calling functions)
No parent
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
11
M = inmem('-completenames');
70.004 s34.4%
104
idx = min([idxplus(:);idxat(:)...
70.002 s12.2%
9
pathNames = which('-all',metho...
70.002 s11.9%
181
classNames = sort(classNames(~...
70.001 s7.4%
83
if strcmp(thisPath(end-1:end),...
70.001 s4.9%
All other lines  0.004 s29.2%
Totals  0.013 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function181
Non-code lines (comments, blank lines)108
Code lines (lines that can run)73
Code lines that did run23
Code lines that did not run50
Coverage (did run/can run)31.51 %
Function listing
time 
Calls 
 line
   1 
function classNames = functionhintsfunc(methodName)
   2 
% This undocumented function may be removed in a future release.
   3 

   4 
% UTGETCLASSESFORMETHOD  Utility function used by Function Hints for
   5 
% obtaining the class names for a function/method on the MATLAB path
   6 

   7 
%   Copyright 1984-2010 The MathWorks, Inc.
   8 

  0.002 
      7 
   9
pathNames = which('-all',methodName); 
< 0.001 
      7 
  10
classNames = cell(length(pathNames),1); 
  0.004 
      7 
  11
M = inmem('-completenames'); 
< 0.001 
      7 
  12
for k=1:length(pathNames) 
< 0.001 
      7 
  13
    thisPath = pathNames{k}; 
< 0.001 
      7 
  14
    fileSeps = strfind(thisPath,filesep); 
  15 
    
  16 
    
  17 
    %  Must handle these cases
  18 
    %  built-in (C:\Work\R2008b\Acontrol_051508\matlab\toolbox\matlab\datatypes\double)
  19 
    %  double is a built-in method
  20 
    %  isFocused is a Java method
  21 
    
  22 
    
  23 
    % Matlab OOPS
  24 
    %   dir/@ClassName
  25 
    %
  26 
    % UDD
  27 
    %    % dir/@PackageName/@ClassName
  28 
    % Note: UDD package scoped functions
  29 
    %    % dir/@PackageName/FcnName
  30 
    %
  31 
    % MCOS Classes can be defined in the following manner
  32 
    %   dir/ClassName
  33 
    %   dir/@ClassName
  34 
    %   dir/+packagename1/ClassName
  35 
    %   dir/+packagename1/@ClassName
  36 
    %   dir/+packagename1/.../+packagenameN/ClassName
  37 
    %   dir/+packagename1/.../+packagenameN/@ClassName
  38 
    % Note: package scoped functions are
  39 
    %   dir/+packagename1/FcnName
  40 
    %   dir/+packagename1/.../+packagenameN/FcnName
  41 
    %
  42 
    % For MCOS classes WITHOUT an @ symbol in the path the function which
  43 
    % -all returns the dir/.../ClassName.m file. In this case when
  44 
    % determining the candidate class name from the file path remove ".m" from
  45 
    % the file path
  46 
    %
  47 
    % For MCOS classes WITH an @ symbol in the path the function which
  48 
    % -all returns either
  49 
    %       dir/.../@ClassName/ClassName.m file if function is
  50 
    %           defined in the class definition
  51 
    %       dir/.../@ClassName/FncName.m file if function defined as a
  52 
    %           separate file
  53 
    % In these cases when determining the candidate class name from the file path
  54 
    % remove "/*.m" from the file Path
  55 
    %
  56 
    % Now the candidate class name can be formed by
  57 
    %   1. If an @ or + is in the file path, remove the path before the
  58 
    %   first occurrence of the character. Replace all filesep with "."
  59 
    %   and remove all + or @ chars to create the candidate class name.
  60 
    %   2. If NO @ or + is in the file path, the candidate class name is
  61 
    %   the last portion of the string after the last filesep.
  62 
    
  63 
    % Enumerated list of cases
  64 
    % 1. dir/FcnName.m
  65 
    % 2. dir/@ClassName/FcnName.m (OOPs)
  66 
    % 3. dir/@PackageName/@ClassName/FcnName.m (UDD)
  67 
    % 4. dir/@PackageName/FcnName.m (UDD)
  68 
    % 5. dir/ClassName/ClassName.m (MCOS) FncName.m defined in classdef
  69 
    % 6. dir/@ClassName/FncName.m (MCOS)
  70 
    % 7. dir/@ClassName/ClassName.m % (MCOS) FncName.m defined in classdef
  71 
    % 8. dir/+packagename1/ClassName.m (MCOS) FncName.m defined in classdef
  72 
    % 9. dir/+packagename1/@ClassName/FcnName.m (MCOS)
  73 
    % 10. dir/+packagename1/@ClassName/ClassName.m  (MCOS) FncName.m defined in classdef
  74 
    % 11. dir/+packagename1/.../+packagenameN/ClassName.m (MCOS) FncName.m defined in classdef
  75 
    % 12. dir/+packagename1/.../+packagenameN/@ClassName\FcnName.m (MCOS)
  76 
    % 13. dir/+packagename1/.../+packagenameN/@ClassName\ClassName.m (MCOS)
  77 
    % 14. dir/+packagename1/FcnName.m (MCOS)
  78 
    % 15. dir/+packagename1/.../+packagenameN/FcnName.m (MCOS)
  79 
    % 16. Any .m file could become a .mlx file, so all of above use cases that listed are applicable.
  80 
    
< 0.001 
      7 
  81
    try 
  82 
        % Exclude loaded packages with Documented set to off.
< 0.001 
      7 
  83
        if strcmp(thisPath(end-1:end),'.m') || strcmp(thisPath(end-1:end),'.p') || strcmp(thisPath(end-3:end),'.mlx') %&& any(strcmp(thisPath,M)) 
  84 
            
  85 
            % Determine ClassName or package
< 0.001 
      7 
  86
            candidateClassName = thisPath; 
< 0.001 
      7 
  87
            idxplus = strfind(candidateClassName,'+'); 
< 0.001 
      7 
  88
            idxat = strfind(candidateClassName,'@'); 
  89 
            % candidateClassName is the fully qualified class name (including
  90 
            % path)
< 0.001 
      7 
  91
            if isempty(idxat) 
  92 
                % Potentially a MCOS class or func remove ".m" or ".mlx"(1,5,8,11)
< 0.001 
      7 
  93
                if strcmp(thisPath(end-3:end),'.mlx') 
  94 
                    candidateClassName = candidateClassName(1:end-4);
< 0.001 
      7 
  95
                else 
< 0.001 
      7 
  96
                    candidateClassName = candidateClassName(1:end-2); 
< 0.001 
      7 
  97
                end 
  98 
            else
  99 
                % Truncate path only if class is defined with an @ (i.e. remove
 100 
                % method name to leave the class)
 101 
                candidateClassName = candidateClassName(1:fileSeps(end)-1);
< 0.001 
      7 
 102
            end 
 103 
            % First location of either the "+" or "@" char
  0.002 
      7 
 104
            idx = min([idxplus(:);idxat(:)]); 
 105 
            
< 0.001 
      7 
 106
            if isempty(idx) % cases 1,5 
< 0.001 
      7 
 107
                candidateClassName = candidateClassName(fileSeps(end)+1:end); 
< 0.001 
      7 
 108
                if strcmp(candidateClassName,methodName) || ~isInMem(M,candidateClassName) % case 1 
< 0.001 
      7 
 109
                    continue; 
 110 
                end
 111 
                classH = meta.class.fromName(candidateClassName);
 112 
                if ~isempty(classH) && classH.Hidden % case 5
 113 
                    % Class but is hidden
 114 
                    continue;
 115 
                end
 116 
            else
 117 
                % Form classname replace fileseps with '.' and remove
 118 
                % '+','@'
 119 
                candidateClassName = candidateClassName(idx+1:end);
 120 
                if ~isInMem(M,candidateClassName)
 121 
                    continue;
 122 
                end
 123 
                candidateClassName = regexprep(candidateClassName,filesep,'.');
 124 
                candidateClassName = regexprep(candidateClassName,{'+','@'},'');
 125 
                %             candidateClassName = regexprep(candidateClassName,'+','');
 126 
                %             candidateClassName = regexprep(candidateClassName,'@','');
 127 
                if isempty(idxplus) % cases 2,3,4,6,7 no + but have an @
 128 
                    % MCOS class or UDD Package or Matlab oops
 129 
                    if length(idxat) == 1 % cases 2,4,6,7
 130 
                        % MCOS class or UDD package method or Matlab oops
 131 
                        classH = meta.class.fromName(candidateClassName);
 132 
                        if isempty(classH) % cases 2,4 not MCOS
 133 
                            % Must be a UDD package method or matlab oops
 134 
                            packageH = findpackage(regexprep(candidateClassName,'\..*',''));
 135 
                            if ~isempty(packageH) % case 4
 136 
                                % UDD Package method
 137 
                                continue;
 138 
                            end
 139 
                            
 140 
                        elseif classH.Hidden % cases 6,7 hidden
 141 
                            % MCOS Class but it is hidden
 142 
                            continue;
 143 
                        end
 144 
                    else % case 3                        
 145 
                        packageH = findpackage(regexprep(candidateClassName,'\..*',''));
 146 
                        if ~isempty(packageH) && strcmp(packageH.Documented,'off')
 147 
                           continue;
 148 
                        end
 149 
                    end
 150 
                    
 151 
                else % cases 8-15
 152 
                    % MCOS package with a +
 153 
                    classH = meta.class.fromName(candidateClassName);
 154 
                    
 155 
                    if ~isempty(classH) && classH.Hidden
 156 
                        continue;
 157 
                    end
 158 
                end
 159 
                
 160 
            end
 161 
            % Hard coded classes to exclude
 162 
            if any(strcmp(candidateClassName,{'uint16','int8','uint8',...
 163 
                    'logical','single','double','uint32','int16','int32',...
 164 
                    'uint64','int64','char','opaque','handle', 'mtree'}))
 165 
                continue;
 166 
            elseif any(strcmp(methodName,methods(candidateClassName))) && ...
 167 
                    ~strcmpi(methodName,candidateClassName)
 168 
                % Make sure that the method name is a case sensitive match
 169 
                % see g478089 and not a constructor g513203 
 170 
                classNames{k} = candidateClassName;
 171 
            end
 172 
            
 173 
            
 174 
        end
 175 
    catch me %#ok<NASGU>
 176 
        continue
 177 
    end
 178 
end
 179 

 180 
% Remove unused entries in the classNames array.
< 0.001 
      7 
 181
classNames = sort(classNames(~cellfun('isempty',classNames))); 

Other subfunctions in this file are not included in this listing.