Memory [AIX]: Detect memory based on pages (like Solaris) for more accuracy
This commit is contained in:
parent
415ef5d4ae
commit
91f8510ef3
1 changed files with 13 additions and 12 deletions
21
neofetch
21
neofetch
|
@ -2307,10 +2307,20 @@ get_memory() {
|
|||
esac
|
||||
;;
|
||||
|
||||
"Solaris")
|
||||
"Solaris" | "AIX")
|
||||
hw_pagesize="$(pagesize)"
|
||||
case "$os" in
|
||||
"Solaris")
|
||||
pages_total="$(kstat -p unix:0:system_pages:pagestotal | awk '{print $2}')"
|
||||
pages_free="$(kstat -p unix:0:system_pages:pagesfree | awk '{print $2}')"
|
||||
;;
|
||||
|
||||
"AIX")
|
||||
IFS=$'\n'"| " read -d "" -ra mem_stat <<< "$(svmon -G -O unit=page)"
|
||||
pages_total="${mem_stat[11]}"
|
||||
pages_free="${mem_stat[16]}"
|
||||
;;
|
||||
esac
|
||||
mem_total="$((pages_total * hw_pagesize / 1024 / 1024))"
|
||||
mem_free="$((pages_free * hw_pagesize / 1024 / 1024))"
|
||||
mem_used="$((mem_total - mem_free))"
|
||||
|
@ -2322,15 +2332,6 @@ get_memory() {
|
|||
mem_used="$((${mem_used/max} / 1024 / 1024))"
|
||||
;;
|
||||
|
||||
"AIX")
|
||||
IFS=$'\n'"| " read -d "" -ra mem_stat <<< "$(svmon -G -O unit=MB)"
|
||||
|
||||
mem_total="${mem_stat[11]/.*}"
|
||||
mem_free="${mem_stat[16]/.*}"
|
||||
mem_used="$((mem_total - mem_free))"
|
||||
mem_label="MB"
|
||||
;;
|
||||
|
||||
"IRIX")
|
||||
IFS=$'\n' read -d "" -ra mem_cmd <<< "$(pmem)"
|
||||
IFS=" " read -ra mem_stat <<< "${mem_cmd[0]}"
|
||||
|
|
Loading…
Reference in a new issue