From: Nathan Skrzypczak Date: Fri, 17 Sep 2021 09:51:46 +0000 (+0200) Subject: vppinfra: move format_table from perfmon X-Git-Tag: v22.02-rc0~25 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=0e6584014afc41ad1d9750ee6d09c698311aa818;hp=a274c3a2ed8c4f1f38cb6f126326b4e6798869d2;p=vpp.git vppinfra: move format_table from perfmon This code seems really usefull for reuse in other plugins, for pretty table formatting Type: feature Change-Id: Ib5784a0dfc81b7d5a5d1f5ccdd02072e460a50fb Signed-off-by: Nathan Skrzypczak --- diff --git a/src/plugins/perfmon/CMakeLists.txt b/src/plugins/perfmon/CMakeLists.txt index e2f8888c388..060c425df4d 100644 --- a/src/plugins/perfmon/CMakeLists.txt +++ b/src/plugins/perfmon/CMakeLists.txt @@ -21,7 +21,6 @@ add_vpp_plugin(perfmon dispatch_wrapper.c linux.c perfmon.c - table.c intel/core.c intel/uncore.c intel/bundle/membw_bound.c diff --git a/src/plugins/perfmon/cli.c b/src/plugins/perfmon/cli.c index ce191eac35b..2c0ff9e8a14 100644 --- a/src/plugins/perfmon/cli.c +++ b/src/plugins/perfmon/cli.c @@ -15,7 +15,7 @@ #include #include -#include +#include uword unformat_perfmon_bundle_name (unformat_input_t *input, va_list *args) diff --git a/src/vppinfra/CMakeLists.txt b/src/vppinfra/CMakeLists.txt index c682d70f6f1..8114ea19ea4 100644 --- a/src/vppinfra/CMakeLists.txt +++ b/src/vppinfra/CMakeLists.txt @@ -57,6 +57,7 @@ set(VPPINFRA_SRCS error.c fifo.c format.c + format_table.c graph.c hash.c heap.c @@ -134,6 +135,7 @@ set(VPPINFRA_HEADERS fifo.h file.h format.h + format_table.h graph.h hash.h heap.h diff --git a/src/plugins/perfmon/table.c b/src/vppinfra/format_table.c similarity index 99% rename from src/plugins/perfmon/table.c rename to src/vppinfra/format_table.c index e3fc0982bb0..5d83f7a6abe 100644 --- a/src/plugins/perfmon/table.c +++ b/src/vppinfra/format_table.c @@ -22,7 +22,7 @@ */ #include -#include "table.h" +#include static table_text_attr_t default_title = { .flags = TTAF_FG_COLOR_SET | TTAF_BOLD, diff --git a/src/plugins/perfmon/table.h b/src/vppinfra/format_table.h similarity index 73% rename from src/plugins/perfmon/table.h rename to src/vppinfra/format_table.h index 93102a033f0..f9b66a77c40 100644 --- a/src/plugins/perfmon/table.h +++ b/src/vppinfra/format_table.h @@ -21,8 +21,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef __table_h__ -#define __table_h__ +#ifndef __format_table_h__ +#define __format_table_h__ typedef enum { @@ -81,18 +81,19 @@ typedef struct int n_footer_cols; } table_t; -format_function_t format_table; +__clib_export format_function_t format_table; -void table_format_title (table_t *t, char *fmt, ...); -void table_format_cell (table_t *t, int c, int r, char *fmt, ...); -void table_set_cell_align (table_t *t, int c, int r, - table_text_attr_align_t a); -void table_set_cell_fg_color (table_t *t, int c, int r, - table_text_attr_color_t v); -void table_set_cell_bg_color (table_t *t, int c, int r, - table_text_attr_color_t v); -void table_free (table_t *t); -void table_add_header_col (table_t *t, int n_strings, ...); -void table_add_header_row (table_t *t, int n_strings, ...); +__clib_export void table_format_title (table_t *t, char *fmt, ...); +__clib_export void table_format_cell (table_t *t, int c, int r, char *fmt, + ...); +__clib_export void table_set_cell_align (table_t *t, int c, int r, + table_text_attr_align_t a); +__clib_export void table_set_cell_fg_color (table_t *t, int c, int r, + table_text_attr_color_t v); +__clib_export void table_set_cell_bg_color (table_t *t, int c, int r, + table_text_attr_color_t v); +__clib_export void table_free (table_t *t); +__clib_export void table_add_header_col (table_t *t, int n_strings, ...); +__clib_export void table_add_header_row (table_t *t, int n_strings, ...); #endif