summaryrefslogtreecommitdiff
path: root/linuxstatus/update.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-06 05:24:11 -0600
committerJeff Carr <[email protected]>2024-01-06 05:24:11 -0600
commit4529b473dc12d8a4d1b49c9ee1ba89897f86d616 (patch)
tree20cdc5bd7c644e3fb8d7afa8e7b872b1f2082684 /linuxstatus/update.go
parenta808bb55189a44d0c3b2965805c14644f8102cca (diff)
add LinuxStatus()
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'linuxstatus/update.go')
-rw-r--r--linuxstatus/update.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/linuxstatus/update.go b/linuxstatus/update.go
new file mode 100644
index 0000000..1ab8cee
--- /dev/null
+++ b/linuxstatus/update.go
@@ -0,0 +1,31 @@
+package linuxstatus
+
+import (
+ "errors"
+ "fmt"
+ "time"
+
+ "go.wit.com/log"
+)
+
+func (ls *LinuxStatus) Update() {
+ log.Info("linuxStatus() Update() START")
+ if ls == nil {
+ log.Error(errors.New("linuxStatus() Update() ls == nil"))
+ return
+ }
+ duration := timeFunction(func () {
+ linuxLoop()
+ })
+ s := fmt.Sprint(duration)
+ ls.speedActual.Set(s)
+
+ if (duration > 500 * time.Millisecond ) {
+ // ls.speed, "SLOW")
+ } else if (duration > 100 * time.Millisecond ) {
+ // ls.speed, "OK")
+ } else {
+ // ls.speed, "FAST")
+ }
+ log.Info("linuxStatus() Update() END")
+}