aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp/api/api.c
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-07-23 09:53:06 -0400
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-07-31 13:20:52 +0000
commita47a5f20a3b5bb2191d40c47fc0a9976376680c8 (patch)
tree81d8f1e8a0c198f0d3b34818df99fd9ba6f8fd1e /src/vpp/api/api.c
parent07f87546c2b29ac07ec652420c8c3aef6a7faec6 (diff)
api papi: add alias for timestamp(datetime)/timedelta
Now that we have support for f64: - create explicit types for timestamp(datetime)/timedelta - update log_details to use timestamp and remove redundant string representation. If you need the string representation, in python do str(timestamp). If you prefer the raw f64 value, the client can pass in the _no_type_conversion option. Type: feature Change-Id: I547b5fa7122d2afa12628b7db0192c23babbbae8 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'src/vpp/api/api.c')
-rw-r--r--src/vpp/api/api.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c
index 9ae027dab9b..801cf186904 100644
--- a/src/vpp/api/api.c
+++ b/src/vpp/api/api.c
@@ -86,7 +86,7 @@ _(SHOW_THREADS, show_threads) \
_(GET_NODE_GRAPH, get_node_graph) \
_(GET_NEXT_INDEX, get_next_index) \
_(LOG_DUMP, log_dump) \
-_(SHOW_VPE_SYSTEM_TIME_TICKS, show_vpe_system_time_ticks) \
+_(SHOW_VPE_SYSTEM_TIME, show_vpe_system_time) \
_(GET_F64_ENDIAN_VALUE, get_f64_endian_value) \
_(GET_F64_INCREMENT_BY_ONE, get_f64_increment_by_one) \
@@ -480,26 +480,23 @@ vl_api_get_node_graph_t_handler (vl_api_get_node_graph_t * mp)
static void
show_log_details (vl_api_registration_t * reg, u32 context,
- f64 timestamp_ticks, u8 * timestamp,
+ f64 timestamp,
vl_api_log_level_t * level, u8 * msg_class, u8 * message)
{
u32 msg_size;
vl_api_log_details_t *rmp;
- msg_size =
- sizeof (*rmp) + vec_len (timestamp) + vec_len (msg_class) +
- vec_len (message);
+ msg_size = sizeof (*rmp) + vec_len (msg_class) + vec_len (message);
rmp = vl_msg_api_alloc (msg_size);
clib_memset (rmp, 0, msg_size);
rmp->_vl_msg_id = ntohs (VL_API_LOG_DETAILS);
rmp->context = context;
- rmp->timestamp_ticks = clib_host_to_net_f64 (timestamp_ticks);
+ rmp->timestamp = clib_host_to_net_f64 (timestamp);
rmp->level = htonl (*level);
- char *p = (char *) &rmp->timestamp;
+ char *p = (char *) &rmp->msg_class;
- p += vl_api_vec_to_api_string (timestamp, (vl_api_string_t *) p);
p += vl_api_vec_to_api_string (msg_class, (vl_api_string_t *) p);
p += vl_api_vec_to_api_string (message, (vl_api_string_t *) p);
@@ -532,8 +529,6 @@ vl_api_log_dump_t_handler (vl_api_log_dump_t * mp)
e = vec_elt_at_index (lm->entries, i);
if (start_time <= e->timestamp + time_offset)
show_log_details (reg, mp->context, e->timestamp + time_offset,
- format (0, "%U", format_time_float, 0,
- e->timestamp + time_offset),
(vl_api_log_level_t *) & e->level,
format (0, "%U", format_vlib_log_class, e->class),
e->string);
@@ -543,15 +538,14 @@ vl_api_log_dump_t_handler (vl_api_log_dump_t * mp)
}
static void
- vl_api_show_vpe_system_time_ticks_t_handler
- (vl_api_show_vpe_system_time_ticks_t * mp)
+vl_api_show_vpe_system_time_t_handler (vl_api_show_vpe_system_time_t * mp)
{
int rv = 0;
- vl_api_show_vpe_system_time_ticks_reply_t *rmp;
+ vl_api_show_vpe_system_time_reply_t *rmp;
/* *INDENT-OFF* */
- REPLY_MACRO2(VL_API_SHOW_VPE_SYSTEM_TIME_TICKS_REPLY,
+ REPLY_MACRO2(VL_API_SHOW_VPE_SYSTEM_TIME_REPLY,
({
- rmp->vpe_system_time_ticks = clib_host_to_net_f64 (unix_time_now ());
+ rmp->vpe_system_time = clib_host_to_net_f64 (unix_time_now ());
}));
/* *INDENT-ON* */
}