summaryrefslogtreecommitdiffstats
path: root/src/vlib/stats/shared.h
blob: 8e44ce3dc8615629eb1225023a19bf06db0cdd24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* SPDX-License-Identifier: Apache-2.0
 * Copyright(c) 2022 Cisco Systems, Inc.
 */

#ifndef included_stat_segment_shared_h
#define included_stat_segment_shared_h

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_NAME_VECTOR,
  STAT_DIR_TYPE_EMPTY,
  STAT_DIR_TYPE_SYMLINK,
} stat_directory_type_t;

typedef struct
{
  stat_directory_type_t type;
  union
  {
    struct
    {
      uint32_t index1;
      uint32_t index2;
    };
    uint64_t index;
    uint64_t value;
    void *data;
    uint8_t **string_vector;
  };
#define VLIB_STATS_MAX_NAME_SZ 128
  char name[VLIB_STATS_MAX_NAME_SZ];
} vlib_stats_entry_t;

/*
 * Shared header first in the shared memory segment.
 */
typedef struct
{
  uint64_t version;
  void *base;
  volatile uint64_t epoch;
  volatile uint64_t in_progress;
  volatile vlib_stats_entry_t *directory_vector;
} vlib_stats_shared_header_t;

#endif /* included_stat_segment_shared_h */