mirror of
https://github.com/openbsd/src.git
synced 2024-12-21 23:18:00 -08:00
Make CPU frequencies human readable with -h in systat sensors
.
ok miod@
This commit is contained in:
parent
7f757eb407
commit
d651af2f0d
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.28 2018/05/30 13:43:50 krw Exp $
|
||||
# $OpenBSD: Makefile,v 1.29 2024/11/08 08:45:47 matthieu Exp $
|
||||
|
||||
PROG= systat
|
||||
|
||||
@ -12,6 +12,6 @@ SRCS= dkstats.c engine.c if.c inetname.c iostat.c main.c mbufs.c netstat.c \
|
||||
pool.c malloc.c cpu.c uvm.c
|
||||
|
||||
DPADD= ${LIBCURSES} ${LIBM} ${LIBKVM}
|
||||
LDADD= -lcurses -lm -lkvm
|
||||
LDADD= -lcurses -lm -lkvm -lutil
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: sensors.c,v 1.32 2020/07/15 07:13:56 kettenis Exp $ */
|
||||
/* $OpenBSD: sensors.c,v 1.33 2024/11/08 08:45:47 matthieu Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Deanna Phillips <deanna@openbsd.org>
|
||||
@ -29,6 +29,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <util.h>
|
||||
#include "systat.h"
|
||||
|
||||
struct sensor sensor;
|
||||
@ -274,7 +275,12 @@ showsensor(struct sensinfo *s)
|
||||
tbprintf("%3.2f%%", s->sn_value / 1000.0);
|
||||
break;
|
||||
case SENSOR_FREQ:
|
||||
tbprintf("%11.2f Hz", s->sn_value / 1000000.0);
|
||||
if (humanreadable) {
|
||||
char buf[FMT_SCALED_STRSIZE];
|
||||
fmt_scaled(s->sn_value / 1000000.0, buf);
|
||||
tbprintf("%sHz", buf);
|
||||
} else
|
||||
tbprintf("%11.2f Hz", s->sn_value / 1000000.0);
|
||||
break;
|
||||
case SENSOR_ANGLE:
|
||||
tbprintf("%3.4f degrees", s->sn_value / 1000000.0);
|
||||
|
Loading…
Reference in New Issue
Block a user