aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2021-09-17 11:51:46 +0200
committerDamjan Marion <dmarion@me.com>2021-09-17 20:10:59 +0000
commit0e6584014afc41ad1d9750ee6d09c698311aa818 (patch)
tree6b9c1d1ecef0c77829c6470eb817d091036b902d
parenta274c3a2ed8c4f1f38cb6f126326b4e6798869d2 (diff)
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 <nathan.skrzypczak@gmail.com>
-rw-r--r--src/plugins/perfmon/CMakeLists.txt1
-rw-r--r--src/plugins/perfmon/cli.c2
-rw-r--r--src/vppinfra/CMakeLists.txt2
-rw-r--r--src/vppinfra/format_table.c (renamed from src/plugins/perfmon/table.c)2
-rw-r--r--src/vppinfra/format_table.h (renamed from src/plugins/perfmon/table.h)29
5 files changed, 19 insertions, 17 deletions
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 <vnet/vnet.h>
#include <perfmon/perfmon.h>
-#include <perfmon/table.h>
+#include <vppinfra/format_table.h>
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
index e3fc0982bb0..5d83f7a6abe 100644
--- a/src/plugins/perfmon/table.c
+++ b/src/vppinfra/format_table.c
@@ -22,7 +22,7 @@
*/
#include <vppinfra/format.h>
-#include "table.h"
+#include <vppinfra/format_table.h>
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
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