This is a static copy of a profile report

Home

Function details for RandStream.RandStream>localGetSetGlobalStreamThis is a static copy of a profile report

Home

RandStream.RandStream>localGetSetGlobalStream (Calls: 2, Time: 0.007 s)
Generated 19-Jun-2021 04:39:03 using performance time.
class method in file /nfs/linux/matlab-2019b/toolbox/matlab/randfun/@RandStream/RandStream.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
...dStream>RandStream.getGlobalStreamclass method1
...dStream>RandStream.setGlobalStreamclass method1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
866
globe = RandStream.createGloba...
10.003 s44.1%
860
if builtin('_RandStream_inLega...
20.003 s37.1%
873
globe = stream;
10.000 s6.4%
865
elseif isempty(globe) || ~isva...
20.000 s3.9%
872
builtin('_RandStream_getset_me...
10.000 s2.2%
All other lines  0.000 s6.3%
Totals  0.007 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
...ream>RandStream.createGlobalStreamclass method10.003 s39.5%
RandStream.RandStream>RandStream.deleteclass method10.000 s3.4%
Self time (built-ins, overhead, etc.)  0.004 s57.1%
Totals  0.007 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function28
Non-code lines (comments, blank lines)8
Code lines (lines that can run)20
Code lines that did run14
Code lines that did not run6
Coverage (did run/can run)70.00 %
Function listing
time 
Calls 
 line
 850 
function stream = localGetSetGlobalStream(stream)
< 0.001 
      2 
 851
persistent globe; 
< 0.001 
      2 
 852
persistent legacy; 
< 0.001 
      2 
 853
mlock 
 854 

 855 
% If the local handle to the global/legacy stream is empty, this is
 856 
% the first time through, so we need to create the stream.  If the
 857 
% local handle is invalid, the stream must have been deleted at some
 858 
% point, so we need to get hold of the new stream that was created
 859 
% automatically underneath.
  0.003 
      2 
 860
if builtin('_RandStream_inLegacyMode') 
 861 
    if isempty(legacy) || ~isvalid(legacy)
 862 
        legacy = RandStream.createLegacyStream();
 863 
    end
 864 
    globe = legacy;
< 0.001 
      2 
 865
elseif isempty(globe) || ~isvalid(globe) 
  0.003 
      1 
 866
    globe = RandStream.createGlobalStream(); 
< 0.001 
      2 
 867
end 
 868 

< 0.001 
      2 
 869
if nargin == 0 
< 0.001 
      1 
 870
    stream = globe; 
< 0.001 
      1 
 871
elseif isa(stream,'RandStream') && isvalid(stream) 
< 0.001 
      1 
 872
    builtin('_RandStream_getset_mex','defaultstream', stream.StreamID); 
< 0.001 
      1 
 873
    globe = stream; 
 874 
else
 875 
    error(message('MATLAB:RandStream:setglobalstream:InvalidInput'));
< 0.001 
      2 
 876
end 
< 0.001 
      2 
 877
end 

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