9cec1ee46f571ba3a84b23b87fe76d4eb55414e9
[vpp.git] / src / vpp / app / stat_client.h
1 /*
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:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15 #ifndef __included_stat_client_h__
16 #define __included_stat_client_h__
17
18 #include <vlib/vlib.h>
19 #include <vppinfra/socket.h>
20 #include <svm/ssvm.h>
21 #include <vlibapi/api.h>
22 #include <vlibmemory/api.h>
23 #include <vlibmemory/socket_api.h>
24 #include <vlibmemory/socket_client.h>
25 #include <vpp/stats/stats.h>
26
27 typedef struct
28 {
29   u64 current_epoch;
30
31   /* Cached pointers to scalar quantities, these wont change */
32   f64 *vector_rate_ptr;
33   f64 *input_rate_ptr;
34
35   volatile int segment_ready;
36
37   /*
38    * Cached pointers to vector quantities,
39    * MUST invalidate when the epoch changes
40    */
41   vlib_counter_t **intfc_rx_counters;
42   vlib_counter_t **intfc_tx_counters;
43
44   u64 *thread_0_error_counts;
45   u64 source_address_match_error_index;
46
47   /* mapped stats segment object */
48   ssvm_private_t stat_segment;
49
50   /* Socket client object */
51   socket_client_main_t *socket_client_main;
52
53   /* Spinlock for the stats segment */
54   clib_spinlock_t *stat_segment_lockp;
55
56   u8 *socket_name;
57 } stat_client_main_t;
58
59 extern stat_client_main_t stat_client_main;
60
61 #endif /* __included_stat_client_h__ */
62
63
64 /*
65  * fd.io coding-style-patch-verification: ON
66  *
67  * Local Variables:
68  * eval: (c-set-style "gnu")
69  * End:
70  */