refactor: use available memory instead of free memory

This commit is contained in:
Kagura 2024-10-13 16:45:38 +08:00
parent 4270abeea2
commit ea60b6ea4b
5 changed files with 4 additions and 21 deletions

1
.idea/.gitignore vendored
View file

@ -1,3 +1,4 @@
# Default ignored files
/shelf/
/workspace.xml
/deploymentTargetSelector.xml

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetSelector">
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2024-10-13T08:08:20.168147544Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="LocalEmulator" identifier="path=/home/kagura/.android/avd/Pixel_6_API_35.avd" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection />
</SelectionState>
</selectionStates>
</component>
</project>

View file

@ -14,7 +14,7 @@ fn get_sys() -> String {
let kernel = System::kernel_version();
// In mb (original result is in b)
let all_memory = sys.total_memory()/1024/1024;
let free_memory = sys.free_memory()/1024/1024;
let available_memory = sys.available_memory()/1024/1024;
let kernel_string = match kernel {
Some(k) => format!("kernel: {}\n", k),
@ -22,8 +22,8 @@ fn get_sys() -> String {
};
format!(
"{}{}MB free of {}MB memory",
kernel_string, free_memory, all_memory
"{}memory:{}MB available, {}MB in total",
kernel_string, available_memory, all_memory
)
}