summaryrefslogtreecommitdiffstats
path: root/vppinfra/vppinfra/timing_wheel.h
diff options
context:
space:
mode:
Diffstat (limited to 'vppinfra/vppinfra/timing_wheel.h')
-rw-r--r--vppinfra/vppinfra/timing_wheel.h47
1 files changed, 31 insertions, 16 deletions
diff --git a/vppinfra/vppinfra/timing_wheel.h b/vppinfra/vppinfra/timing_wheel.h
index d5cffdb93e6..7daea994248 100644
--- a/vppinfra/vppinfra/timing_wheel.h
+++ b/vppinfra/vppinfra/timing_wheel.h
@@ -17,7 +17,8 @@
#include <vppinfra/format.h>
-typedef struct {
+typedef struct
+{
/* Time of this element in units cpu clock ticks relative to time
base. 32 bits should be large enough for serveral kilo-seconds
to elapse before we have to re-set time base. */
@@ -28,7 +29,8 @@ typedef struct {
} timing_wheel_elt_t;
/* Overflow wheel elements where time does not fit into 32 bits. */
-typedef struct {
+typedef struct
+{
/* Absolute time of this element. */
u64 cpu_time;
@@ -38,23 +40,26 @@ typedef struct {
u32 pad;
} timing_wheel_overflow_elt_t;
-typedef struct {
+typedef struct
+{
/* 2^M bits: 1 means vector is non-zero else zero. */
- uword * occupancy_bitmap;
+ uword *occupancy_bitmap;
/* 2^M element table of element vectors, one for each time bin. */
- timing_wheel_elt_t ** elts;
+ timing_wheel_elt_t **elts;
} timing_wheel_level_t;
-typedef struct {
+typedef struct
+{
/* Vector of refill counts per level. */
- u64 * refills;
+ u64 *refills;
/* Number of times cpu time base was rescaled. */
u64 cpu_time_base_advances;
} timing_wheel_stats_t;
-typedef struct {
+typedef struct
+{
/* Each bin is a power of two clock ticks (N)
chosen so that 2^N >= min_sched_time. */
u8 log2_clocks_per_bin;
@@ -75,17 +80,17 @@ typedef struct {
/* 2^M - 1. */
u32 bins_per_wheel_mask;
- timing_wheel_level_t * levels;
+ timing_wheel_level_t *levels;
- timing_wheel_overflow_elt_t * overflow_pool;
+ timing_wheel_overflow_elt_t *overflow_pool;
/* Free list of element vector so we can recycle old allocated vectors. */
- timing_wheel_elt_t ** free_elt_vectors;
+ timing_wheel_elt_t **free_elt_vectors;
- timing_wheel_elt_t * unexpired_elts_pending_insert;
+ timing_wheel_elt_t *unexpired_elts_pending_insert;
/* Hash table of user data values which have been deleted but not yet re-inserted. */
- uword * deleted_user_data_hash;
+ uword *deleted_user_data_hash;
/* Enable validation for debugging. */
u32 validate;
@@ -117,7 +122,8 @@ void timing_wheel_init (timing_wheel_t * w,
u64 current_cpu_time, f64 cpu_clocks_per_second);
/* Insert user data on wheel at given CPU time stamp. */
-void timing_wheel_insert (timing_wheel_t * w, u64 insert_cpu_time, u32 user_data);
+void timing_wheel_insert (timing_wheel_t * w, u64 insert_cpu_time,
+ u32 user_data);
/* Delete user data from wheel (until it is again inserted). */
void timing_wheel_delete (timing_wheel_t * w, u32 user_data);
@@ -125,8 +131,9 @@ void timing_wheel_delete (timing_wheel_t * w, u32 user_data);
/* Advance wheel and return any expired user data in vector. If non-zero
min_next_expiring_element_cpu_time will return a cpu time stamp
before which there are guaranteed to be no elements in the current wheel. */
-u32 * timing_wheel_advance (timing_wheel_t * w, u64 advance_cpu_time, u32 * expired_user_data,
- u64 * min_next_expiring_element_cpu_time);
+u32 *timing_wheel_advance (timing_wheel_t * w, u64 advance_cpu_time,
+ u32 * expired_user_data,
+ u64 * min_next_expiring_element_cpu_time);
/* Returns absolute time in clock cycles of next expiring element. */
u64 timing_wheel_next_expiring_elt_time (timing_wheel_t * w);
@@ -138,3 +145,11 @@ format_function_t format_timing_wheel;
void timing_wheel_validate (timing_wheel_t * w);
#endif /* included_clib_timing_wheel_h */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */