2%> Return a MATLAB
string containing the current system information.<br>
5%> ``str`` : The output scalar MATLAB
string containing the current system information.<br>
6%> ``cache`` : The output scalar MATLAB
string representing the path to the
7%> cache file containing the current system information.<br>
8%> The returned cache file path has the form:<br>
10%> <DIR>/.info<YEAR><MONTH>.cache<br>
14%> <li> ``<DIR>`` is replaced by the directory containing the function [pm.sys.info()](@ref
info),
15%> <li> ``<YEAR>`` is replaced by the current year,
16%> <li> ``<MONTH>`` is replaced by the current month.
18%> This means that the cache file contents are supposed to be updated only every month
if necessary.<br>
19%> A cache file is generated because retrieving system information is an expensive shell command-line operation.<br>
20%> The time expense is particularly notable on Windows systems.<br>
25%> [str, cache] = pm.sys.info()
30%> \include{lineno} example/sys/
info/main.m
32%> \include{lineno} example/sys/
info/main.out.m
37%> \JoshuaOsborne, May 21 2024, 5:31 AM, University of Texas at Arlington<br>
38%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
39%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
40function [str, cache] =
info()
43 [dirname, ~, ~] = fileparts(mfilename('fullpath'));
44 cache = fullfile(
string(dirname), prefix +
string(year(date)) +
string(month(date)) + suffix); % update cache once a month.
46 delete(prefix + "*" + suffix);
51 cmd = "uname -a; sysctl -a | grep machdep.cpu";
54 cmd = "uname -a; lscpu";
56 [failed, str] = system(cmd);
60 + "Failed to fetch the system information on the current system. skipping..." ...
64 fid = fopen(cache, 'wt');
65 fprintf(fid, "%s", str);
68 str = fileread(cache);
function info()
Return a MATLAB string containing the current system information.