STATS: Separate socket for fd exchange.
[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 <vpp/stats/stats.h>
22
23 typedef struct
24 {
25   u64 current_epoch;
26
27   /* Cached pointers to scalar quantities, these wont change */
28   f64 *vector_rate_ptr;
29   f64 *input_rate_ptr;
30   f64 *last_runtime_ptr;
31   f64 *last_runtime_stats_clear_ptr;
32
33   volatile int segment_ready;
34
35   /*
36    * Cached pointers to vector quantities,
37    * MUST invalidate when the epoch changes
38    */
39   vlib_counter_t **intfc_rx_counters;
40   vlib_counter_t **intfc_tx_counters;
41   u8 *serialized_nodes;
42
43   u64 *thread_0_error_counts;
44   u64 source_address_match_error_index;
45
46   /* mapped stats segment object */
47   ssvm_private_t stat_segment;
48
49   /* Spinlock for the stats segment */
50   clib_spinlock_t *stat_segment_lockp;
51
52   u8 *socket_name;
53 } stat_client_main_t;
54
55 extern stat_client_main_t stat_client_main;
56
57 #endif /* __included_stat_client_h__ */
58
59
60 /*
61  * fd.io coding-style-patch-verification: ON
62  *
63  * Local Variables:
64  * eval: (c-set-style "gnu")
65  * End:
66  */