Stat segment / client: show run" works now
[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   f64 *last_runtime_ptr;
35   f64 *last_runtime_stats_clear_ptr;
36
37   volatile int segment_ready;
38
39   /*
40    * Cached pointers to vector quantities,
41    * MUST invalidate when the epoch changes
42    */
43   vlib_counter_t **intfc_rx_counters;
44   vlib_counter_t **intfc_tx_counters;
45   u8 *serialized_nodes;
46
47   u64 *thread_0_error_counts;
48   u64 source_address_match_error_index;
49
50   /* mapped stats segment object */
51   ssvm_private_t stat_segment;
52
53   /* Socket client object */
54   socket_client_main_t *socket_client_main;
55
56   /* Spinlock for the stats segment */
57   clib_spinlock_t *stat_segment_lockp;
58
59   u8 *socket_name;
60 } stat_client_main_t;
61
62 extern stat_client_main_t stat_client_main;
63
64 #endif /* __included_stat_client_h__ */
65
66
67 /*
68  * fd.io coding-style-patch-verification: ON
69  *
70  * Local Variables:
71  * eval: (c-set-style "gnu")
72  * End:
73  */