stats: Remove unneeded dependencies in stat_client 56/16156/2
authorOle Troan <ot@cisco.com>
Fri, 23 Nov 2018 22:07:13 +0000 (23:07 +0100)
committerDamjan Marion <dmarion@me.com>
Mon, 26 Nov 2018 19:53:55 +0000 (19:53 +0000)
Remove exposing stat_client_main internals and atomics to
simplify use from C++.

Change-Id: Ie864170fee8b4eaa2fd7f98556cf0ebb46cb1a2a
Signed-off-by: Ole Troan <ot@cisco.com>
src/vpp-api/client/stat_client.c
src/vpp-api/client/stat_client.h
src/vpp/stats/stat_segment.c
src/vpp/stats/stat_segment.h

index 98c2757..538820a 100644 (file)
 #include <vppinfra/lock.h>
 #include "stat_client.h"
 #include <stdatomic.h>
+#include <vpp/stats/stat_segment.h>
 
+struct stat_client_main_t
+{
+  uint64_t current_epoch;
+  stat_segment_shared_header_t *shared_header;
+  stat_segment_directory_entry_t *directory_vector;
+  ssize_t memory_size;
+};
 
 stat_client_main_t stat_client_main;
 
index aeca634..31fd82b 100644 (file)
 #define included_stat_client_h
 
 #include <stdint.h>
-#include <vpp/stats/stat_segment.h>
+#include <unistd.h>
 #include <vlib/counter_types.h>
 
-typedef struct
+typedef enum
 {
-  uint64_t current_epoch;
-  stat_segment_shared_header_t *shared_header;
-  stat_segment_directory_entry_t *directory_vector;
-  ssize_t memory_size;
-} stat_client_main_t;
+  STAT_DIR_TYPE_ILLEGAL = 0,
+  STAT_DIR_TYPE_SCALAR_INDEX,
+  STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE,
+  STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED,
+  STAT_DIR_TYPE_ERROR_INDEX,
+} stat_directory_type_t;
+
+/* Default socket to exchange segment fd */
+#define STAT_SEGMENT_SOCKET_FILE "/run/vpp/stats.sock"
+
+typedef struct stat_client_main_t stat_client_main_t;
 
 typedef struct
 {
index 3c5d4eb..9b6b37b 100644 (file)
@@ -21,7 +21,7 @@
 #include <vnet/devices/devices.h>      /* vnet_get_aggregate_rx_packets */
 #undef HAVE_MEMFD_CREATE
 #include <vppinfra/linux/syscall.h>
-
+#include <vpp-api/client/stat_client.h>
 stat_segment_main_t stat_segment_main;
 
 /*
index 21c7c3b..3ce8280 100644 (file)
 #include <stdatomic.h>
 #include <vlib/vlib.h>
 #include <vppinfra/socket.h>
-
-/* Default socket to exchange segment fd */
-#define STAT_SEGMENT_SOCKET_FILE "/run/vpp/stats.sock"
-
-typedef enum
-{
-  STAT_DIR_TYPE_ILLEGAL = 0,
-  STAT_DIR_TYPE_SCALAR_INDEX,
-  STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE,
-  STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED,
-  STAT_DIR_TYPE_ERROR_INDEX,
-} stat_directory_type_t;
+#include <vpp-api/client/stat_client.h>
 
 typedef enum
 {