2 * Copyright (c) 2018 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.
16 #ifndef __VOM_STAT_CLIENT_H__
17 #define __VOM_STAT_CLIENT_H__
24 #include <vpp-api/client/stat_client.h>
35 typedef uint64_t stat_counter_t;
37 * A representation of a stat client in VPP
43 * stat data representation
48 * stat data constructor
53 * stat data custom constructor
55 stat_data_t(stat_segment_data_t* stat_seg_data);
60 const std::string& name() const;
65 const stat_directory_type_t& type() const;
68 * Get pointer to actual data
70 double get_stat_segment_scalar_data();
71 uint64_t get_stat_segment_error_data();
72 uint64_t** get_stat_segment_simple_counter_data();
73 counter_t** get_stat_segment_combined_counter_data();
79 const std::string m_name;
84 const stat_directory_type_t m_type;
87 * union of pointers to actual stat data
91 double m_scalar_value;
92 uint64_t m_error_Value;
93 uint64_t** m_simple_counter_vec;
94 counter_t** m_combined_counter_vec;
99 * vector of stat_data_t
101 typedef std::vector<stat_data_t> stat_data_vec_t;
104 * Stat Client constructor with custom socket name
106 stat_client(std::string& socket_name);
109 * Stat Client constructor with custom vector of patterns
111 stat_client(std::vector<std::string>& pattern);
114 * Stat Client constructor with custom socket name and vector of patterns
116 stat_client(std::string socket_name, std::vector<std::string> patterns);
119 * Stat Client constructor
124 * Stat Client destructor
129 * Stat Client copy constructor
131 stat_client(const stat_client& o);
134 * Connect to stat segment
139 * Disconnect to stat segment
144 * Get vector length of VPP style vector
146 int vec_len(void* vec);
149 * Free VPP style vector
151 void vec_free(void* vec);
154 * ls on the stat directory using given pattern
159 * dump all the stats for given pattern
161 const stat_data_vec_t& dump();
164 * dump stats for given index in stat directory
166 const stat_data_vec_t& dump_entry(uint32_t index);
169 * Free stat segment data
176 * get index to name of stat
178 std::string index_to_name(uint32_t index);
184 std::string m_socket_name;
187 * vector of patterns for stats
189 std::vector<std::string> m_patterns;
197 * Pointer to VPP style vector of stat indexes
199 uint32_t* m_counter_vec;
202 * Pointer to stat segment
204 stat_segment_data_t* m_stat_seg_data;
207 * Vector of stat data
209 stat_data_vec_t m_stat_data;
214 * fd.io coding-style-patch-verification: ON
217 * eval: (c-set-style "mozilla")