GET_PROCESS_PRIORITY get priority of the current Matlab session

This is an integer value like 'nice' on Unix-like systems On Windows systems the char value is like 'Normal'

Contents

Inputs

Outputs

function [i, b] = get_process_priority(backend)
if nargin < 1
  backend = {'dotnet', 'python', 'sys'};
else
  backend = cellstr(backend);
end

i = [];

for j = 1:numel(backend)
  b = backend{j};
  switch b
    case 'dotnet'
      i = stdlib.dotnet.get_process_priority();
    case 'python'
      if stdlib.matlabOlderThan('R2022a'), continue, end
      i = stdlib.python.get_process_priority();
    case 'sys'
      i = stdlib.sys.get_process_priority();
    otherwise
      error('stdlib:get_process_priority:ValueError', 'Unknown backend: %s', b)
  end

  if ~isempty(i)
    return
  end
end

end

%!test
%! mustBeInteger(stdlib.get_process_priority())