print amps and watts
authordlg <dlg@openbsd.org>
Tue, 26 Mar 2024 00:54:24 +0000 (00:54 +0000)
committerdlg <dlg@openbsd.org>
Tue, 26 Mar 2024 00:54:24 +0000 (00:54 +0000)
usr.bin/kstat/kstat.c

index e396e08..1050e4b 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: kstat.c,v 1.13 2023/11/16 03:17:34 dlg Exp $ */
+/* $OpenBSD: kstat.c,v 1.14 2024/03/26 00:54:24 dlg Exp $ */
 
 /*
  * Copyright (c) 2020 David Gwynne <dlg@openbsd.org>
@@ -473,6 +473,16 @@ kstat_kv(const void *d, ssize_t len)
                        printf("%.2f VAC", f / 1000000.0);
                        break;
 
+               case KSTAT_KV_T_AMPS: /* uA */
+                       f = kstat_kv_amps(kv);
+                       printf("%.3f A", f / 1000000.0);
+                       break;
+
+               case KSTAT_KV_T_WATTS: /* uW */
+                       f = kstat_kv_watts(kv);
+                       printf("%.3f W", f / 1000000.0);
+                       break;
+
                default:
                        printf("unknown type %u, stopping\n", kv->kv_type);
                        return;