summaryrefslogtreecommitdiff
path: root/lib/libdevstat/devstat.c
AgeCommit message (Collapse)Author
2023-11-26lib: Automated cleanup of cdefs and other formattingWarner Losh
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
2023-11-15Add interface NVME to devstatAlexander Motin
This allows to list only NVMe devices in systat, iostat, vmstat, etc. Previously those were counted as OTHER.
2023-08-16Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2019-12-03devstat_selectdevs: resize dev_select only after copying data out of itAndriy Gapon
The resizing could be a downsizing so some data would be lost and we could attempt to read past the end of the new memory allocation. MFC after: 2 weeks Sponsored by: Panzura Notes: svn path=/head/; revision=355325
2017-11-26lib: further adoption of SPDX licensing ID tags.Pedro F. Giffuni
Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326219
2015-06-04Remove unused variable and silence clang warnings.Marcelo Araujo
Differential Revision: D2681 Reviewed by: rodrigc Notes: svn path=/head/; revision=283976
2015-02-27Remove an obsolete comment in devstat(3) about the accuracy of theKenneth D. Merry
milliseconds per transaction (DSM_MS_PER_TRANSACTION) calculation. The comment was accurate many years ago when the kernel didn't record I/O times on a per-I/O basis, but now that we do collect that information in most areas, it isn't correct. The milliseconds per transaction values are correct, assuming the I/O duration has been recorded. Sponsored by: Spectra Logic MFC after: 3 days Notes: svn path=/head/; revision=279346
2013-12-25Fix a typo.Sergey Kandaurov
Notes: svn path=/head/; revision=259883
2013-12-25For vmcore, calculate time relative to device creation upon time_uptime.Sergey Kandaurov
Previously it used a clock from live kernel. MFC after: 2 weeks Notes: svn path=/head/; revision=259878
2012-12-15New devstat metrics for devstat_compute_statistics():Mikolaj Golub
DSM_TOTAL_DURATION DSM_TOTAL_DURATION_READ DSM_TOTAL_DURATION_WRITE DSM_TOTAL_DURATION_FREE DSM_TOTAL_DURATION_OTHER DSM_TOTAL_BUSY_TIME Notes: svn path=/head/; revision=244270
2012-01-06Handle memory allocation failures in devstat_getdevs(), devstat_selectdevs(),Guy Helmer
and devstat_buildmatch(). PR: bin/83359 Reviewed by: ken Notes: svn path=/head/; revision=229735
2011-04-04Do not increment num_args if strsep(3) returned an empty field.Sergey Kandaurov
That fixes devstat_buildmatch(3) crashes with certain strings. Reported by: arundel MFC after: 2 weeks Notes: svn path=/head/; revision=220319
2005-10-04Remove an unused variable.Stefan Farfeleder
Reviewed by: ken Notes: svn path=/head/; revision=150948
2005-04-26Use __func__ throughout devstat.c instead of defining a func_nameMaxime Henrion
variable in each function. Notes: svn path=/head/; revision=145553
2005-04-26Make this compile with GCC4 by fixing a signedness issue.Maxime Henrion
Reviewed by: md5(1) Notes: svn path=/head/; revision=145549
2004-06-25Remove the use of cast as lvalue. GCC 3.4 isses a deprecation warningAlexander Kabaev
for this now. Notes: svn path=/head/; revision=131075
2003-10-13Include <nlist.h> for nlist-related declarations instead of depending onBruce Evans
namespace pollution in <kvm.h>. Notes: svn path=/head/; revision=121064
2003-08-17It is not an error to have no devices.Poul-Henning Kamp
Notes: svn path=/head/; revision=119029
2003-04-19Add prototype for compute_stats() so that libdevstat is WARNS=4 clean.Poul-Henning Kamp
Spotted by: kris Notes: svn path=/head/; revision=113710
2003-04-09If rounding results in -epsilon device busy %, set it to zero.Poul-Henning Kamp
Notes: svn path=/head/; revision=113281
2003-03-19typoPoul-Henning Kamp
Notes: svn path=/head/; revision=112406
2003-03-19Further unbreak devstat: sort the index array in correct order too.Poul-Henning Kamp
Notes: svn path=/head/; revision=112405
2003-03-18Add more devstat calculations, mostly filling in holes, but also addingPoul-Henning Kamp
a couple of reqests: DSM_BUSY_PCT and DSM_QUEUE_LENGTH. I have no further plans for mutilating this API at this point in time, and will update the man-page to reflect current reality as the next thing. Reviewed by: ken Notes: svn path=/head/; revision=112373
2003-03-15And I managed to make a regression here too.Poul-Henning Kamp
I have too many source trees :-( Notes: svn path=/head/; revision=112293
2003-03-15Run a revision of the devstat interface:Poul-Henning Kamp
Kernel: Change statistics to use the *uptime() timescale (ie: relative to boottime) rather than the UTC aligned timescale. This makes the device statistics code oblivious to clock steps. Change timestamps to bintime format, they are cheaper. Remove the "busy_count", and replace it with two counter fields: "start_count" and "end_count", which are updated in the down and up paths respectively. This removes the locking constraint on devstat. Add a timestamp argument to devstat_start_transaction(), this will normally be a timestamp set by the *_bio() function in bp->bio_t0. Use this field to calculate duration of I/O operations. Add two timestamp arguments to devstat_end_transaction(), one is the current time, a NULL pointer means "take timestamp yourself", the other is the timestamp of when this transaction started (see above). Change calculation of busy_time to operate on "the salami principle": Only when we are idle, which we can determine by the start+end counts being identical, do we update the "busy_from" field in the down path. In the up path we accumulate the timeslice in busy_time and update busy_from. Change the byte_* and num_* fields into two arrays: bytes[] and operations[]. Userland: Change the misleading "busy_time" name to be called "snap_time" and make the time long double since that is what most users need anyway, fill it using clock_gettime(CLOCK_MONOTONIC) to put it on the same timescale as the kernel fields. Change devstat_compute_etime() to operate on struct bintime. Remove the version 2 legacy interface: the change to bintime makes compatibility far too expensive. Fix a bug in systat's "vm" page where boot relative busy times would be bogus. Bump __FreeBSD_version to 500107 Review & Collaboration by: ken Notes: svn path=/head/; revision=112288
2003-02-16Remove include of <sys/dkstat.h>Poul-Henning Kamp
Notes: svn path=/head/; revision=111000
2003-02-16Premptively include <sys/resource.h> to get the cp_time[CPUSTATES].Poul-Henning Kamp
Notes: svn path=/head/; revision=110998
2002-03-21Remove 'register' keyword.David E. O'Brien
Notes: svn path=/head/; revision=92913
2001-09-23Turn on WARNS?= 2 for libdevstat.Kenneth D. Merry
Submitted by: "Sergey A. Osokin" <osa@freebsd.org.ru> Notes: svn path=/head/; revision=83868
2001-09-16Implement __FBSDID()Matthew Dillon
Notes: svn path=/head/; revision=83551
2001-08-21Fix some style inconsistencies introduced in rev 1.10, as well as someKenneth D. Merry
other inconsistencies that I missed in my review of rev 1.7. Also fix a cut-n-paste error from an earlier revision. Notes: svn path=/head/; revision=82028
2001-08-20Better snprintf() handling.Brian Somers
Prompted by: bde Notes: svn path=/head/; revision=81984
2001-08-20Handle snprintf() returning -1.Brian Somers
MFC after: 2 weeks Notes: svn path=/head/; revision=81972
2001-08-18Implement compute_stats() in terms of devstat_compute_statistics(). ThisKenneth D. Merry
gets rid of the duplicated code in compute_stats(). Add a new DSM_SKIP statistic type for devstat_compute_statistics() that causes the subsequent variable argument to be skipped. Thanks to Sergey Osokin for coding up my idea/code fragment. Submitted by: "Sergey A. Osokin" <osa@freebsd.org.ru> Notes: svn path=/head/; revision=81883
2001-08-04Add some features to libdevstat, and overhaul the interface a bit:Thomas Moestl
1.) prefix all functions in the library with devstat_ (compatability functions are available for all functions that were chaned in an incompatible way, but are deprecated). 2.) Add a pointer to a kvm_t as the first argument to functions that used to get their information via sysctl; they behave the same as before when NULL is passed as this argument, otherwise, the information is obtained via libkvm using the supplied handle. 3.) Add a new function, devstat_compute_statistics(), that is intended to replace the old compute_stats() function. It offers more statistics data, and has a more flexible interface. libdevstat does now require libkvm; a library depedency is added, so that libkvm only needs to be explicitely specified for statically linked programs. The library major version number is bumped. Submitted by: Sergey A. Osokin <osa@freebsd.org.ru>, ken (3) Reviewed by: ken Notes: svn path=/head/; revision=81133
1999-08-28$Id$ -> $FreeBSD$Peter Wemm
Notes: svn path=/head/; revision=50476
1999-03-22Address our users in a civilized manner. (They may know better, but probablyPoul-Henning Kamp
just forgot it, it is certainly no reason to don't insult them.) Notes: svn path=/head/; revision=44936
1998-10-14Fix a couple of potential buffer overrun cases.Kenneth D. Merry
Submitted by: imp Notes: svn path=/head/; revision=40364
1998-09-20Change the devstat generation number from an int to a long. The int-sizedKenneth D. Merry
generation was causing unaligned access faults on the Alpha. I have incremented the devstat version number, since this is an interface change. You'll need to recompile libdevstat, systat, iostat, vmstat and rpc.rstatd along with your kernel. Partially Submitted by: Andrew Gallatin <gallatin@cs.duke.edu> Notes: svn path=/head/; revision=39498
1998-09-18Fix some error message format problems in checkversion() and getversion().Kenneth D. Merry
Reported By: bde Notes: svn path=/head/; revision=39451
1998-09-15Device statistics library. Used by iostat, vmstat, and systat toJustin T. Gibbs
format and analyze the output of the new device statistics sysctls. Submitted by: "Kenneth D. Merry" <ken@FreeBSD.org> Notes: svn path=/head/; revision=39211