Skip to content

Commit

Permalink
memory_get: Get memory on linux/windows
Browse files Browse the repository at this point in the history
  • Loading branch information
cultpenguin committed Aug 22, 2022
1 parent e80ea55 commit 927a123
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions misc/memory_get.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function [mem_total,mem_used,mem_available]=memory_get();
mem_total=[];
mem_used=[];
mem_available=[];
if isunix
[r,w] = unix('free | grep Mem');
ws=split(w);
mem_total=str2num(ws{2})/1e+6;
mem_used=str2num(ws{3})/1e+6;
mem_available=str2num(ws{4})/1e+6;
else iswin==1
[USERVIEW, SYSTEMVIEW] = memory;
mem_total=USERVIEW.MaxPossibleArrayBytes/1024/1E+6;
end
2 changes: 1 addition & 1 deletion nscore.m
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
xlabel('X');
ylabel('CPDF')
title('ORIG CDF')
legend('ORG+Head+Tail','ORIGINAL',4)
legend('ORG+Head+Tail','ORIGINAL')

end

Expand Down

0 comments on commit 927a123

Please sign in to comment.