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 // SystemStats represents global system statistics.
18 type SystemStats struct {
22 LastStatsClear float64
26 // NodeStats represents per node statistics.
27 type NodeStats struct {
31 // NodeCounters represents node counters.
32 type NodeCounters struct {
34 NodeName string // requires VPP 19.04+
42 // InterfaceStats represents per interface statistics.
43 type InterfaceStats struct {
44 Interfaces []InterfaceCounters
47 // InterfaceCounters represents interface counters.
48 type InterfaceCounters struct {
50 InterfaceName string // requires VPP 19.04+
59 RxUnicast [2]uint64 // packets[0], bytes[1]
60 RxMulticast [2]uint64 // packets[0], bytes[1]
61 RxBroadcast [2]uint64 // packets[0], bytes[1]
62 TxUnicastMiss [2]uint64 // packets[0], bytes[1]
63 TxMulticast [2]uint64 // packets[0], bytes[1]
64 TxBroadcast [2]uint64 // packets[0], bytes[1]
74 // ErrorStats represents statistics per error counter.
75 type ErrorStats struct {
79 // ErrorCounter represents error counter.
80 type ErrorCounter struct {
85 // BufferStats represents statistics per buffer pool.
86 type BufferStats struct {
87 Buffer map[string]BufferPool
90 // BufferPool represents buffer pool.
91 type BufferPool struct {
98 // StatsProvider provides the methods for getting statistics.
99 type StatsProvider interface {
100 GetSystemStats() (*SystemStats, error)
101 GetNodeStats() (*NodeStats, error)
102 GetInterfaceStats() (*InterfaceStats, error)
103 GetErrorStats(names ...string) (*ErrorStats, error)
104 GetBufferStats() (*BufferStats, error)