Show host uptime information

This commit is contained in:
Simon Hausmann 2021-10-04 16:28:34 +02:00
parent f0fc877f4e
commit 02e01ba04f
3 changed files with 14 additions and 1 deletions

View file

@ -12,6 +12,7 @@ import { TabWidget, StandardButton, GridBox, ListView } from "sixtyfps_widgets.6
SysInfo := Dialog {
property uptime <=> uptime.text;
property cpu_count <=> cpu-count.text;
property cpu_model <=> cpu-model.text;
property cpu_vendor <=> cpu-vendor.text;
@ -69,7 +70,15 @@ SysInfo := Dialog {
Text {
text: "\{floor(mem_size_kb / (1000*1000))} GB";
}
}
}
Row {
Text{
text: "Uptime:";
max-width: min-width;
}
uptime := Text {
}
}
Rectangle {}
}
}

View file

@ -9,6 +9,7 @@
# Please contact info@sixtyfps.io for more information.
# LICENSE END
uptime=`uptime -p | cut -d " " -f2-`
cpu_count=`grep processor /proc/cpuinfo | wc -l`
cpu_vendor=`awk -F ": " '/vendor_id/{ print $2; exit}' < /proc/cpuinfo`
cpu_model=`awk -F ": " '/model name/{ print $2; exit}' < /proc/cpuinfo`
@ -17,6 +18,7 @@ partitions=`df --block-size=1 | tail -n+2 | sed 's/\([^ ]*\) *\([^ ]*\) *\([^
sixtyfps-viewer `dirname $0`/sysinfo.60 --load-data - <<EOT
{
"uptime": "$uptime",
"cpu_count": "$cpu_count",
"cpu_vendor": "$cpu_vendor",
"cpu_model": "$cpu_model",

View file

@ -9,6 +9,7 @@
# Please contact info@sixtyfps.io for more information.
# LICENSE END
uptime=`uptime | awk 'BEGIN{FS="up |,"}{print $2}'`
cpu_count=`sysctl -n hw.ncpu`
cpu_vendor=`sysctl -n machdep.cpu.vendor`
cpu_model=`sysctl -n machdep.cpu.brand_string`
@ -17,6 +18,7 @@ partitions=`df -lk | tail -n+2 | sed 's/\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^
sixtyfps-viewer `dirname $0`/sysinfo.60 --load-data - <<EOT
{
"uptime": "$uptime",
"cpu_count": "$cpu_count",
"cpu_vendor": "$cpu_vendor",
"cpu_model": "$cpu_model",