Update vendoring (#685)
* Update vendor github.com/coreos/go-systemd/dbus@v15 * Update vendor github.com/ema/qdisc * Update vendor github.com/godbus/dbus * Update vendor github.com/golang/protobuf/proto * Update vendor github.com/lufia/iostat * Update vendor github.com/matttproud/golang_protobuf_extensions/pbutil@v1.0.0 * Update vendor github.com/prometheus/client_golang/... * Update vendor github.com/prometheus/common/... * Update vendor github.com/prometheus/procfs/... * Update vendor github.com/sirupsen/logrus@v1.0.3 Adds vendor golang.org/x/crypto * Update vendor golang.org/x/net/... * Update vendor golang.org/x/sys/... * Update end to end output.
This commit is contained in:
parent
ba96b6561b
commit
deadfef4c9
283 changed files with 47085 additions and 29054 deletions
2
vendor/github.com/lufia/iostat/README.md
generated
vendored
2
vendor/github.com/lufia/iostat/README.md
generated
vendored
|
|
@ -1,4 +1,4 @@
|
|||
# iostat - reports I/O statistics
|
||||
# iostat - reports I/O and CPU statistics
|
||||
|
||||
[](https://godoc.org/github.com/lufia/iostat)
|
||||
|
||||
|
|
|
|||
19
vendor/github.com/lufia/iostat/iostat.go
generated
vendored
19
vendor/github.com/lufia/iostat/iostat.go
generated
vendored
|
|
@ -1,4 +1,4 @@
|
|||
// Package iostat presents I/O statistics.
|
||||
// Package iostat presents I/O and CPU statistics.
|
||||
package iostat
|
||||
|
||||
import "time"
|
||||
|
|
@ -18,3 +18,20 @@ type DriveStats struct {
|
|||
ReadLatency time.Duration
|
||||
WriteLatency time.Duration
|
||||
}
|
||||
|
||||
// CPUStats represents CPU statistics.
|
||||
type CPUStats struct {
|
||||
// consumed cpu ticks for each.
|
||||
User uint64
|
||||
Nice uint64
|
||||
Sys uint64
|
||||
Idle uint64
|
||||
}
|
||||
|
||||
// LoadAvg represents load averages of the system.
|
||||
type LoadAvg struct {
|
||||
// load averages
|
||||
Load1 float64 // over past 1 minute
|
||||
Load5 float64 // over past 5 minutes
|
||||
Load15 float64 // over past 15 minutes
|
||||
}
|
||||
|
|
|
|||
24
vendor/github.com/lufia/iostat/iostat_darwin.c
generated
vendored
24
vendor/github.com/lufia/iostat/iostat_darwin.c
generated
vendored
|
|
@ -1,14 +1,16 @@
|
|||
#include <stdint.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include "iostat_darwin.h"
|
||||
|
||||
#define IOKIT 1 /* to get io_name_t in device_types.h */
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#include <IOKit/storage/IOBlockStorageDriver.h>
|
||||
#include <IOKit/storage/IOMedia.h>
|
||||
#include <IOKit/IOBSD.h>
|
||||
|
||||
#include <mach/mach_host.h>
|
||||
|
||||
static int getdrivestat(io_registry_entry_t d, DriveStats *stat);
|
||||
static int fillstat(io_registry_entry_t d, DriveStats *stat);
|
||||
|
||||
|
|
@ -126,3 +128,23 @@ fillstat(io_registry_entry_t d, DriveStats *stat)
|
|||
CFRelease(props);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
readcpustat(CPUStats *stats)
|
||||
{
|
||||
mach_port_t port;
|
||||
host_cpu_load_info_data_t load;
|
||||
mach_msg_type_number_t n;
|
||||
kern_return_t status;
|
||||
|
||||
port = mach_host_self();
|
||||
n = HOST_CPU_LOAD_INFO_COUNT;
|
||||
status = host_statistics(port, HOST_CPU_LOAD_INFO, (host_info_t)&load, &n);
|
||||
if(status != KERN_SUCCESS)
|
||||
return -1;
|
||||
stats->user = load.cpu_ticks[CPU_STATE_USER];
|
||||
stats->nice = load.cpu_ticks[CPU_STATE_NICE];
|
||||
stats->sys = load.cpu_ticks[CPU_STATE_SYSTEM];
|
||||
stats->idle = load.cpu_ticks[CPU_STATE_IDLE];
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
29
vendor/github.com/lufia/iostat/iostat_darwin.go
generated
vendored
29
vendor/github.com/lufia/iostat/iostat_darwin.go
generated
vendored
|
|
@ -4,6 +4,7 @@ package iostat
|
|||
|
||||
// #cgo LDFLAGS: -framework CoreFoundation -framework IOKit
|
||||
// #include <stdint.h>
|
||||
// #include <CoreFoundation/CoreFoundation.h>
|
||||
// #include "iostat_darwin.h"
|
||||
import "C"
|
||||
import (
|
||||
|
|
@ -35,3 +36,31 @@ func ReadDriveStats() ([]*DriveStats, error) {
|
|||
}
|
||||
return stats, nil
|
||||
}
|
||||
|
||||
// ReadCPUStats returns statistics of CPU usage.
|
||||
func ReadCPUStats() (*CPUStats, error) {
|
||||
var cpu C.CPUStats
|
||||
_, err := C.readcpustat(&cpu)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &CPUStats{
|
||||
User: uint64(cpu.user),
|
||||
Nice: uint64(cpu.nice),
|
||||
Sys: uint64(cpu.sys),
|
||||
Idle: uint64(cpu.idle),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ReadLoadAvg returns load averages over periods of time.
|
||||
func ReadLoadAvg() (*LoadAvg, error) {
|
||||
var load [3]C.double
|
||||
if _, err := C.getloadavg(&load[0], C.int(len(load))); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &LoadAvg{
|
||||
Load1: float64(load[0]),
|
||||
Load5: float64(load[1]),
|
||||
Load15: float64(load[2]),
|
||||
}, nil
|
||||
}
|
||||
|
|
|
|||
9
vendor/github.com/lufia/iostat/iostat_darwin.h
generated
vendored
9
vendor/github.com/lufia/iostat/iostat_darwin.h
generated
vendored
|
|
@ -1,4 +1,5 @@
|
|||
typedef struct DriveStats DriveStats;
|
||||
typedef struct CPUStats CPUStats;
|
||||
|
||||
enum {
|
||||
NDRIVE = 16,
|
||||
|
|
@ -20,4 +21,12 @@ struct DriveStats {
|
|||
int64_t writelat;
|
||||
};
|
||||
|
||||
struct CPUStats {
|
||||
natural_t user;
|
||||
natural_t nice;
|
||||
natural_t sys;
|
||||
natural_t idle;
|
||||
};
|
||||
|
||||
extern int readdrivestat(DriveStats a[], int n);
|
||||
extern int readcpustat(CPUStats *cpu);
|
||||
|
|
|
|||
10
vendor/github.com/lufia/iostat/iostat_linux.go
generated
vendored
10
vendor/github.com/lufia/iostat/iostat_linux.go
generated
vendored
|
|
@ -10,3 +10,13 @@ import (
|
|||
func ReadDriveStats() ([]*DriveStats, error) {
|
||||
return nil, errors.New("not implement")
|
||||
}
|
||||
|
||||
// ReadCPUStats returns statistics of CPU usage.
|
||||
func ReadCPUStats() (*CPUStats, error) {
|
||||
return nil, errors.New("not implement")
|
||||
}
|
||||
|
||||
// ReadLoadAvg returns load averages over periods of time.
|
||||
func ReadLoadAvg() (*LoadAvg, error) {
|
||||
return nil, errors.New("not implement")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue