summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2024-03-26 00:54:25 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2024-03-26 00:54:25 +0000
commite77167e01107973a1cb92e25d7089f0ee8d36b24 (patch)
tree7e345df1faa288b4c674f4dc3db3116d299fcb89 /usr.bin
parent60627aceaae2b037ed5bd6f087baf432fd4483e0 (diff)
print amps and watts
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/kstat/kstat.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.bin/kstat/kstat.c b/usr.bin/kstat/kstat.c
index e396e086103..1050e4bf2c3 100644
--- a/usr.bin/kstat/kstat.c
+++ b/usr.bin/kstat/kstat.c
@@ -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;