Commit Graph

252 Commits

Author SHA1 Message Date
Alexander Leidinger
9f05d312b3 Backout sensors framework.
Requested by:	phk
Discussed on:	cvs-all
2007-10-15 20:00:24 +00:00
Ruslan Ermilov
8f96b509a2 Bump document date for the last change. 2007-10-14 19:12:36 +00:00
Alexander Leidinger
99f6b270e3 Import OpenBSD's sysctl hardware sensors framework.
This commit includes the following core components:

 * sample configuration file for sensorsd
 * rc(8) script and glue code for sensorsd(8)
 * sysctl(3) doc fixes for CTL_HW tree
 * sysctl(3) documentation for hardware sensors
 * sysctl(8) documentation for hardware sensors
 * support for the sensor structure for sysctl(8)
 * rc.conf(5) documentation for starting sensorsd(8)
 * sensor_attach(9) et al documentation
 * /sys/kern/kern_sensors.c
   o sensor_attach(9) API for drivers to register ksensors
   o sensor_task_register(9) API for the update task
   o sysctl(3) glue code
   o hw.sensors shadow tree for sysctl(8) internal magic
 * <sys/sensors.h>
 * HW_SENSORS definition for <sys/sysctl.h>
 * sensors display for systat(1), including documentation
 * sensorsd(8) and all applicable documentation

The userland part of the framework is entirely source-code
compatible with OpenBSD 4.1, 4.2 and  -current as of today.

All sensor readings can be viewed with `sysctl hw.sensors`,
monitored in semi-realtime with `systat -sensors` and also
logged with `sensorsd`.

Submitted by:	Constantine A. Murenin <cnst@FreeBSD.org>
Sponsored by:	Google Summer of Code 2007 (GSoC2007/cnst-sensors)
Mentored by:	syrinx
Tested by:	many
OKed by:	kensmith
Obtained from:	OpenBSD (parts)
2007-10-14 10:45:31 +00:00
Jeff Roberson
b61ce5b0e6 - Move all of the PS_ flags into either p_flag or td_flags.
- p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or
   previously the sched_lock.  These bugs have existed for some time.
 - Allow swapout to try each thread in a process individually and then
   swapin the whole process if any of these fail.  This allows us to move
   most scheduler related swap flags into td_flags.
 - Keep ki_sflag for backwards compat but change all in source tools to
   use the new and more correct location of P_INMEM.

Reported by:	pho
Reviewed by:	attilio, kib
Approved by:	re (kensmith)
2007-09-17 05:31:39 +00:00
Ruslan Ermilov
8be3f374a7 - Stop computing %CPU for the imaginary idle process; we now
have real idle processes for that.

- Fix the display on SMP by not scaling the sum of %CPU down
  to 1.  Instead, display raw data as computed by the kernel,
  like in top(1).

Reviewed by:	bde
Approved by:	re (bmah)
MFC after:	1 week
2007-09-11 07:51:03 +00:00
John Baldwin
5900369697 Expand TCP counters from 9 digits to 12.
MFC after:	1 week
PR:		bin/112881
2007-06-15 18:12:58 +00:00
John Baldwin
595bf788f6 Consistently indent the R() macro for fields on the right-side of the
display to make the code easier to read.

PR:		bin/112881
2007-06-15 18:00:10 +00:00
John Baldwin
02a50a14b3 Add a new counter for retransmitted packets due to SACK.
PR:		bin/112881
Submitted by:	Phil Rosenthal <pr  isprime com>
2007-06-15 17:55:44 +00:00
Ruslan Ermilov
bc68fcf37c Fix definitions of kilobits etc.
PR:		bin/106116
Nudged by:	Rostislav Krasny
MFC after:	3 days
2007-01-18 09:24:08 +00:00
Yaroslav Tykhiy
499a1062fa Add missing things: a prototype and a const qualifier.
Found by:	WARNS=4
2006-12-23 22:39:38 +00:00
Yaroslav Tykhiy
c19a20a7d1 Dynamically resize the Disk column. It was too narrow for modern
disk device names such as da0s1b.  So we also get rid of the nasty
constant 5 scattered over the code.

Implementing this change is a good chance to improve other bits
around it: init saved lengths early, always check return value from
kvm_getswapinfo().
2006-12-23 18:54:49 +00:00
Yaroslav Tykhiy
d668a4922f Clear to EOL after the end of meter so that its reading can decrease. 2006-12-23 18:03:10 +00:00
Yaroslav Tykhiy
b20870dbb5 Make it possible for meter to reach 100% mark when swap is totally full. 2006-12-23 17:46:32 +00:00
Yaroslav Tykhiy
c1b118da86 Improve style:
- Don't define vars inside loops.
- Avoid useless casts.
- Use C idioms.
- Do alike things in a consistent way.
2006-12-23 17:02:09 +00:00
Yaroslav Tykhiy
aee701a96e Reposition the "(swap not configured)" sign WRT the new layout. 2006-12-23 16:48:29 +00:00
Yaroslav Tykhiy
a3600374b4 Eliminate a couple of screen coordinate variables
that were useless and just obfuscated the code.
2006-12-23 16:39:09 +00:00
Yaroslav Tykhiy
12912b5a4a Add some vertical whitespace for easier reading. 2006-12-23 16:31:06 +00:00
Yaroslav Tykhiy
cb059cfe92 Fix the swap display further:
1) Resize the Used column to avoid screen overflow if BLOCKSIZE is long.
2) Track the current swap configuration so that its changes don't break
   the display.

Suggested by:	bde (1)
2006-12-23 15:40:41 +00:00
Yaroslav Tykhiy
7fb2f46a48 Fix the Total line shown if there are >1 swap devices. 2006-12-23 14:30:50 +00:00
Yaroslav Tykhiy
1f4d2a1d84 Start fixing the "swap" display by saving one horizontal position.
Now the display won't overflow the 80-char row if BLOCKSIZE=1024.
The new spacing is also consistent with the "pigs" display.
2006-12-23 14:25:17 +00:00
Ruslan Ermilov
bad4d172b4 - Revert signedness type changes to "struct vmtotal"; by making
them unsigned I made the possible overflows hard to detect,
  and it only saved 1 bit which isn't principal, even less now
  that the underlying issue with the total of virtual memory has
  been fixed.  (For the record, it will overflow with >=2T of
  VM total, with 32-bit ints used to keep counters in pages.)

- While here, fix printing of other "struct vmtotal" members
  such as t_rq, t_dw, t_pw, and t_sw as they are also signed.

Reviewed by:	bde
MFC after:	3 days
2006-11-28 12:46:02 +00:00
Yaroslav Tykhiy
d3985f17d4 Back out rev. 1.17: arch-dependent WARNS level.
The policy is that the WARNS level should characterize the
quality of a piece of code irrespective of any conditions.
Otherwise the code doesn't deserve the WARNS level assigned.

Requested by:	ru
2006-11-27 21:30:38 +00:00
Yaroslav Tykhiy
65b02a0f4b Consistently mark percentage scales as such.
PR:		bin/101975
MFC after:	3 days
2006-11-27 20:19:05 +00:00
Yaroslav Tykhiy
c3d6542fd0 systat(1) reaches WARNS=6 on i386 and amd64. This is good
for catching general regressions in future.  Unfortunately,
it still displays some problems at WARNS=6 on architectures
with stricter alignment requirements, e.g., ia64.
2006-11-27 17:54:28 +00:00
Yaroslav Tykhiy
599cc46d95 The logic of fetchnetstat_sysctl() isn't too complex: if idx is 0,
we set and use xtp; if idx is 1, we set and use xip; the other cases
are impossible.  However, GCC cannot see that xip and xtp are always
initialized before use because they are initialized and used in
different if/else blocks.  So setting them to NULL at the very
beginning won't hurt.
2006-11-27 17:34:40 +00:00
Yaroslav Tykhiy
6549e8c62e + WARNS=4 reminds that nlist.n_name isn't const.
+ Use C99 initializers to be WARNS-clean.
+ The last element in a namelist should have its n_name set to NULL,
  not to an empty string.
2006-11-27 17:24:36 +00:00
Yaroslav Tykhiy
9540596e83 Don't discard a const qualifier from constant strings. 2006-11-27 17:01:31 +00:00
Yaroslav Tykhiy
2506efa78c Remove a wrong "const" qualifier.
Spotted by:	WARNS=6
2006-11-27 16:59:08 +00:00
Yaroslav Tykhiy
dfaa9125d8 Add the Tera scale factor, which is an easy job now.
More scale factors would overflow the command line where
the help for "scale" were shown.
2006-11-27 16:33:44 +00:00
Yaroslav Tykhiy
afe7b9fbb5 Stop exposing things that can be private to convtbl.c. 2006-11-27 16:23:09 +00:00
Yaroslav Tykhiy
aee371e363 Keep all convtbl-related constants and strings in convtbl.[ch]. 2006-11-27 16:14:32 +00:00
Yaroslav Tykhiy
f5d4751c8a Allow for large scale factors. C99 warrants that
ULLONG_MAX is not less than 2^64-1; and uintmax_t
cannot be more narrow than unsigned long long.
This allows for scale factors up to Exa inclusively.

Use plain int for the scale index to be consistent
with ifcmds.c and enum.
2006-11-27 15:26:26 +00:00
Yaroslav Tykhiy
41af362198 Return back one initializer, it is needed. 2006-11-27 15:14:50 +00:00
Yaroslav Tykhiy
f301488570 + Drop useless initializers.
+ style(9).
2006-11-27 15:11:30 +00:00
Yaroslav Tykhiy
ce1bff762d Drop useless #includes. 2006-11-27 14:48:46 +00:00
Yaroslav Tykhiy
0230383747 Use C99 initializers so that we don't really have to worry
about the order of related things at several places.
2006-11-27 14:18:54 +00:00
Yaroslav Tykhiy
ab5c9a0d0a C can enumerate things for us. 2006-11-27 14:16:40 +00:00
Yaroslav Tykhiy
00603ea268 There is no reason to use __inline here because we are rather far
from a path critical to performance.
2006-11-26 20:14:47 +00:00
Yaroslav Tykhiy
a3736d312c Don't overflow from the gigabyte scale to the bit scale if the
number to auto-scale is >= 1024 Gb.  Could be triggered on arches
where ifdata counters had 64 bits.

Reported by:	Miroslav Slavkov on -net
MFC after:	3 days
2006-11-26 20:08:40 +00:00
Yaroslav Tykhiy
91857186f2 The real contents of this file were repeated twice.
The repetition was harmless due to a usual #ifndef _FOO_H_ wrapper.
Fortunately, nobody started to hack the second copy,
so just remove it from the file.

MFC after:	3 days
2006-11-26 19:25:10 +00:00
Ruslan Ermilov
20739dfa44 Fix the format specifier suitable for uintmax_t. 2006-11-23 11:51:23 +00:00
Ruslan Ermilov
5c88a11e6e - Fix types of "struct vmmeter" members so they are unsigned.
- Fix overflow bugs in sysctl(8), systat(1), and vmstat(8)
  when printing values of "struct vmmeter" in kilobytes as
  they don't necessarily fit into 32 bits.  (Fix sysctl(8)
  reporting of a total virtual memory; it's in pages too.)
2006-11-20 16:04:41 +00:00
Ruslan Ermilov
c01e1768d9 Memory utilization subscreen in "vmstat" display lists numbers in KB,
not in number of pages.

PR:		docs/71690
Submitted by:	Jan Srzednicki

(A patch is only partially merged, the rest was already fixed by bde@
in rev. 1.51.)
2006-10-12 10:54:34 +00:00
Yaroslav Tykhiy
2cc3124e10 Obey MK_INET6_SUPPORT. 2006-07-27 14:20:14 +00:00
Robert Watson
df3e013b3e Remove MT_FTABLE printout in systat, as MT_FTABLE mbufs are no longer
used in the kernel.
2006-07-24 01:49:24 +00:00
Brad Davis
eaa9b5ef09 s/on a crt//
systat is working great on this LCD ;)

Submitted by:	Ben Haga <tuximus AT absoludicrous DOT com>
MFC after:	3 days
2006-05-25 06:05:04 +00:00
Bruce Evans
04984aac91 For the vmstat sub-display:
vmstat.c:
Move totfr to be under daefr and prcfr since it logically belongs there.

Move all the count fields (wire, act, inact, cache and free) to near
the bottom of the sub-display (after all the rate fields) to reduce
competition with adjoining sub-displays.

systat.1:
Move things as above.

Attempt to improve missing and poor wording in the description of the
fields.  The long sentence was hard to parse and didn't say anything
about the different units.

Increment .Dd.
2006-05-01 07:02:52 +00:00
Bruce Evans
74a2149c90 Unbreak the support for 24-row terminals in the vmstat display. The
part that handled the 17th and 18th rows of the vmstat-proper subdisplay
was deleted in rev.1.10 when these rows stopped being used and was not
restored when the 17th row was used again.  For such terminals, we now
lose the `buf' field instead of making a mess with it.  Terminals with
fewer than 24 rows have never been supported.

The problem is not avoided by using curses since we use the last line
for data entry and don't use a separate subwindow for this line.
Some other things in the vmstat display could be handled better using
subwindows.
2006-05-01 00:26:43 +00:00
Bruce Evans
1247d9c61c Sort the ex-extended vmstat fields into their documented order in the
output too.

Fine tune all coordinates and most field widths in the vmstat (sub)display
for this and previous changes now that we have to change almost all of them
just to move the ex-extended fields:
- change VMSTATROW back to 7.  It was 6 due to a hack in the extended vm
  stats changes.
- reduce the maximum field width that we try for from 9 to 8.  4 or 5 is
  enough for most fields but we try to use the same width for all fields.
  8 is enough to display everything without changing units memory sizes
  exceed 100GB.

Fix some unrelated coordinates and field widths in comments.
2006-04-30 23:52:16 +00:00
Bruce Evans
de9a857e4c Eliminate the "extended" vm stats. Move all fields in the extended
vm stats to the normal vm stats.  Sort them into the normal stats
according to the man page only in the source code so that diffs are
almost readable.  Reduce style bugs in printing the value of %ozfod.
2006-04-30 22:34:54 +00:00