1 // Copyright (c) 2019 Cisco and/or its affiliates.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at:
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
17 // StatsProvider provides methods for retrieving statistics.
18 type StatsProvider interface {
19 GetSystemStats(*SystemStats) error
20 GetNodeStats(*NodeStats) error
21 GetInterfaceStats(*InterfaceStats) error
22 GetErrorStats(*ErrorStats) error
23 GetBufferStats(*BufferStats) error
24 GetMemoryStats(*MemoryStats) error
27 // SystemStats represents global system statistics.
28 type SystemStats struct {
30 NumWorkerThreads uint64
31 VectorRatePerWorker []uint64
38 // NodeStats represents per node statistics.
39 type NodeStats struct {
43 // NodeCounters represents node counters.
44 type NodeCounters struct {
46 NodeName string // requires VPP 19.04+
54 // InterfaceStats represents per interface statistics.
55 type InterfaceStats struct {
56 Interfaces []InterfaceCounters
59 // InterfaceCounters represents interface counters.
60 type InterfaceCounters struct {
62 InterfaceName string // requires VPP 19.04+
64 Rx InterfaceCounterCombined
65 Tx InterfaceCounterCombined
70 RxUnicast InterfaceCounterCombined
71 RxMulticast InterfaceCounterCombined
72 RxBroadcast InterfaceCounterCombined
73 TxUnicast InterfaceCounterCombined
74 TxMulticast InterfaceCounterCombined
75 TxBroadcast InterfaceCounterCombined
86 // InterfaceCounterCombined defines combined counters for interfaces.
87 type InterfaceCounterCombined struct {
92 // ErrorStats represents statistics per error counter.
93 type ErrorStats struct {
97 // ErrorCounter represents error counter.
98 type ErrorCounter struct {
104 // BufferStats represents statistics per buffer pool.
105 type BufferStats struct {
106 Buffer map[string]BufferPool
109 // BufferPool represents buffer pool.
110 type BufferPool struct {
118 // MemoryStats represents memory stats segment counters.
119 type MemoryStats struct {