tracker

package
v1.7.11-rc-11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2022 License: BSD-3-Clause Imports: 14 Imported by: 30

Documentation

Overview

Package tracker is a generated GoMock package.

Package mock_tracker is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUTargeter

type CPUTargeter interface {
	// Returns the target CPU usage of the given node from:
	// 1. The validator CPU allocation.
	// 2. The at-large CPU allocation.
	// Also returns the portion of CPU usage that should be attributed
	// to the at-large allocation.
	// All returned values are >= 0.
	TargetCPUUsage(nodeID ids.NodeID) (float64, float64, float64)
}

func NewCPUTargeter

func NewCPUTargeter(
	reg prometheus.Registerer,
	config *CPUTargeterConfig,
	vdrs validators.Set,
	cpuTracker TimeTracker,
) (targeter CPUTargeter, err error)

type CPUTargeterConfig

type CPUTargeterConfig struct {
	Clock                 mockable.Clock `json:"-"`
	VdrCPUAlloc           float64        `json:"vdrCPUAlloc"`
	AtLargeCPUAlloc       float64        `json:"atLargeCPUAlloc"`
	PeerMaxAtLargePortion float64        `json:"peerMaxAtLargeAlloc"`
}

type MockCPUTargeter

type MockCPUTargeter struct {
	// contains filtered or unexported fields
}

MockCPUTargeter is a mock of CPUTargeter interface

func NewMockCPUTargeter

func NewMockCPUTargeter(ctrl *gomock.Controller) *MockCPUTargeter

NewMockCPUTargeter creates a new mock instance

func (*MockCPUTargeter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockCPUTargeter) TargetCPUUsage

func (m *MockCPUTargeter) TargetCPUUsage(arg0 ids.NodeID) (float64, float64, float64)

TargetCPUUsage mocks base method

type MockCPUTargeterMockRecorder

type MockCPUTargeterMockRecorder struct {
	// contains filtered or unexported fields
}

MockCPUTargeterMockRecorder is the mock recorder for MockCPUTargeter

func (*MockCPUTargeterMockRecorder) TargetCPUUsage

func (mr *MockCPUTargeterMockRecorder) TargetCPUUsage(arg0 interface{}) *gomock.Call

TargetCPUUsage indicates an expected call of TargetCPUUsage

type MockTimeTracker added in v1.4.10

type MockTimeTracker struct {
	// contains filtered or unexported fields
}

MockTimeTracker is a mock of TimeTracker interface

func NewMockTimeTracker

func NewMockTimeTracker(ctrl *gomock.Controller) *MockTimeTracker

NewMockTimeTracker creates a new mock instance

func (*MockTimeTracker) CumulativeAtLargeUtilization

func (m *MockTimeTracker) CumulativeAtLargeUtilization(arg0 time.Time) float64

CumulativeAtLargeUtilization mocks base method

func (*MockTimeTracker) DecCPU

func (m *MockTimeTracker) DecCPU(arg0 ids.NodeID, arg1 time.Time, arg2 float64)

DecCPU mocks base method

func (*MockTimeTracker) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockTimeTracker) IncCPU

func (m *MockTimeTracker) IncCPU(arg0 ids.NodeID, arg1 time.Time, arg2 float64)

IncCPU mocks base method

func (*MockTimeTracker) TimeUntilUtilization

func (m *MockTimeTracker) TimeUntilUtilization(arg0 ids.NodeID, arg1 time.Time, arg2 float64) time.Duration

TimeUntilUtilization mocks base method

func (*MockTimeTracker) Utilization added in v1.4.10

func (m *MockTimeTracker) Utilization(arg0 ids.NodeID, arg1 time.Time) float64

Utilization mocks base method

type MockTimeTrackerMockRecorder

type MockTimeTrackerMockRecorder struct {
	// contains filtered or unexported fields
}

MockTimeTrackerMockRecorder is the mock recorder for MockTimeTracker

func (*MockTimeTrackerMockRecorder) CumulativeAtLargeUtilization

func (mr *MockTimeTrackerMockRecorder) CumulativeAtLargeUtilization(arg0 interface{}) *gomock.Call

CumulativeAtLargeUtilization indicates an expected call of CumulativeAtLargeUtilization

func (*MockTimeTrackerMockRecorder) DecCPU

func (mr *MockTimeTrackerMockRecorder) DecCPU(arg0, arg1, arg2 interface{}) *gomock.Call

DecCPU indicates an expected call of DecCPU

func (*MockTimeTrackerMockRecorder) IncCPU

func (mr *MockTimeTrackerMockRecorder) IncCPU(arg0, arg1, arg2 interface{}) *gomock.Call

IncCPU indicates an expected call of IncCPU

func (*MockTimeTrackerMockRecorder) TimeUntilUtilization

func (mr *MockTimeTrackerMockRecorder) TimeUntilUtilization(arg0, arg1, arg2 interface{}) *gomock.Call

TimeUntilUtilization indicates an expected call of TimeUntilUtilization

func (*MockTimeTrackerMockRecorder) Utilization

func (mr *MockTimeTrackerMockRecorder) Utilization(arg0, arg1 interface{}) *gomock.Call

Utilization indicates an expected call of Utilization

type TimeTracker

type TimeTracker interface {
	// Registers that the given node started using a CPU at the given time, and
	// that the given portion of the CPU usage should be attributed to the
	// at-large CPU allocation.
	IncCPU(ids.NodeID, time.Time, float64)
	// Registers that the given node stopped using a CPU at the given time, and
	// that the given portion of the CPU usage should be attributed to the
	// at-large CPU allocation.
	DecCPU(ids.NodeID, time.Time, float64)
	// Returns the current EWMA of CPU utilization for the given node.
	Utilization(ids.NodeID, time.Time) float64
	// Returns the current EWMA of CPU utilization by all nodes attributed to
	// the at-large CPU allocation.
	CumulativeAtLargeUtilization(time.Time) float64
	// Returns the duration between [now] and when the CPU utilization of
	// [nodeID] reaches [value], assuming that the node uses no more CPU.
	// If the node's CPU utilization isn't known, or is already <= [value],
	// returns the zero duration.
	TimeUntilUtilization(nodeID ids.NodeID, now time.Time, value float64) time.Duration
}

TimeTracker is an interface for tracking peers' usage of CPU Time

func NewCPUTracker

func NewCPUTracker(
	reg prometheus.Registerer,
	factory meter.Factory,
	halflife time.Duration,
) (TimeTracker, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL