summaryrefslogtreecommitdiffstats
path: root/lib/libdevstat/devstat.h
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2001-08-04 18:25:48 +0000
committertmm <tmm@FreeBSD.org>2001-08-04 18:25:48 +0000
commit37ac1a7962312051ecd4d5ac042973e6aab74d8b (patch)
tree7d17ce05945ef823f56eb89340dc45319d280c7c /lib/libdevstat/devstat.h
parentfb501835eb47e231e6b2d8920c356d3f67c98853 (diff)
downloadFreeBSD-src-37ac1a7962312051ecd4d5ac042973e6aab74d8b.zip
FreeBSD-src-37ac1a7962312051ecd4d5ac042973e6aab74d8b.tar.gz
Add some features to libdevstat, and overhaul the interface a bit:
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
Diffstat (limited to 'lib/libdevstat/devstat.h')
-rw-r--r--lib/libdevstat/devstat.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/libdevstat/devstat.h b/lib/libdevstat/devstat.h
index fd0941c..ec638c1 100644
--- a/lib/libdevstat/devstat.h
+++ b/lib/libdevstat/devstat.h
@@ -33,6 +33,8 @@
#include <sys/cdefs.h>
#include <sys/devicestat.h>
+#include <kvm.h>
+
#define DEVSTAT_ERRBUF_SIZE 2048 /* size of the devstat library error string */
extern char devstat_errbuf[];
@@ -44,6 +46,37 @@ typedef enum {
DEVSTAT_MATCH_PASS = 0x04
} devstat_match_flags;
+typedef enum {
+ DSM_NONE,
+ DSM_TOTAL_BYTES,
+ DSM_TOTAL_BYTES_READ,
+ DSM_TOTAL_BYTES_WRITE,
+ DSM_TOTAL_TRANSFERS,
+ DSM_TOTAL_TRANSFERS_READ,
+ DSM_TOTAL_TRANSFERS_WRITE,
+ DSM_TOTAL_TRANSFERS_OTHER,
+ DSM_TOTAL_BLOCKS,
+ DSM_TOTAL_BLOCKS_READ,
+ DSM_TOTAL_BLOCKS_WRITE,
+ DSM_KB_PER_TRANSFER,
+ DSM_KB_PER_TRANSFER_READ,
+ DSM_KB_PER_TRANSFER_WRITE,
+ DSM_TRANSFERS_PER_SECOND,
+ DSM_TRANSFERS_PER_SECOND_READ,
+ DSM_TRANSFERS_PER_SECOND_WRITE,
+ DSM_TRANSFERS_PER_SECOND_OTHER,
+ DSM_MB_PER_SECOND,
+ DSM_MB_PER_SECOND_READ,
+ DSM_MB_PER_SECOND_WRITE,
+ DSM_BLOCKS_PER_SECOND,
+ DSM_BLOCKS_PER_SECOND_READ,
+ DSM_BLOCKS_PER_SECOND_WRITE,
+ DSM_MS_PER_TRANSACTION,
+ DSM_MS_PER_TRANSACTION_READ,
+ DSM_MS_PER_TRANSACTION_WRITE,
+ DSM_MAX
+} devstat_metric;
+
struct devstat_match {
devstat_match_flags match_fields;
devstat_type_flags device_type;
@@ -88,6 +121,7 @@ typedef enum {
} devstat_select_mode;
__BEGIN_DECLS
+/* Legacy interfaces. */
int getnumdevs(void);
long getgeneration(void);
int getversion(void);
@@ -110,6 +144,27 @@ int compute_stats(struct devstat *current, struct devstat *previous,
long double *blocks_per_second,
long double *ms_per_transaction);
long double compute_etime(struct timeval cur_time, struct timeval prev_time);
+
+/* New interfaces. */
+int devstat_getnumdevs(kvm_t *kd);
+long devstat_getgeneration(kvm_t *kd);
+int devstat_getversion(kvm_t *kd);
+int devstat_checkversion(kvm_t *kd);
+int devstat_getdevs(kvm_t *kd, struct statinfo *stats);
+int devstat_selectdevs(struct device_selection **dev_select, int *num_selected,
+ int *num_selections, long *select_generation,
+ long current_generation, struct devstat *devices,
+ int numdevs, struct devstat_match *matches,
+ int num_matches, char **dev_selections,
+ int num_dev_selections, devstat_select_mode select_mode,
+ int maxshowdevs, int perf_select);
+int devstat_buildmatch(char *match_str, struct devstat_match **matches,
+ int *num_matches);
+int devstat_compute_statistics(struct devstat *current,
+ struct devstat *previous,
+ long double etime, ...);
+long double devstat_compute_etime(struct timeval cur_time,
+ struct timeval prev_time);
__END_DECLS
#endif /* _DEVSTAT_H */
OpenPOWER on IntegriCloud