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