Move cgo portions of FreeBSD devstat collector into own file
Embedding 100 lines of code in a comment doesn't make for good reading, editing or code quality.
This commit is contained in:
parent
20ca0f1376
commit
5e220c1665
3 changed files with 117 additions and 104 deletions
41
collector/devstat_freebsd.h
Normal file
41
collector/devstat_freebsd.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#include <devstat.h>
|
||||
#include <fcntl.h>
|
||||
#include <libgeom.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct {
|
||||
uint64_t read;
|
||||
uint64_t write;
|
||||
uint64_t free;
|
||||
} Bytes;
|
||||
|
||||
typedef struct {
|
||||
uint64_t other;
|
||||
uint64_t read;
|
||||
uint64_t write;
|
||||
uint64_t free;
|
||||
} Transfers;
|
||||
|
||||
typedef struct {
|
||||
double other;
|
||||
double read;
|
||||
double write;
|
||||
double free;
|
||||
} Duration;
|
||||
|
||||
typedef struct {
|
||||
char device[DEVSTAT_NAME_LEN];
|
||||
int unit;
|
||||
Bytes bytes;
|
||||
Transfers transfers;
|
||||
Duration duration;
|
||||
long busyTime;
|
||||
uint64_t blocks;
|
||||
} Stats;
|
||||
|
||||
|
||||
int _get_ndevs();
|
||||
Stats _get_stats(int i);
|
||||
Loading…
Add table
Add a link
Reference in a new issue