mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-upf.git
synced 2025-10-23 08:12:03 +00:00
pfcp_tool: add 'date'
Allow scripts to output timestamps to easily measure how long certain actions took to complete. Related: measuring PFCP session management performance bounds of osmo-upf. Change-Id: I0486cc92ea298bb9926a0e5c26da17ba5970a72c
This commit is contained in:
@@ -134,6 +134,24 @@ DEFUN(c_sleep, c_sleep_cmd,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(c_date, c_date_cmd,
|
||||
"date",
|
||||
"print a timestamp\n")
|
||||
{
|
||||
struct timeval tv = {};
|
||||
struct tm tm = {};
|
||||
|
||||
osmo_gettimeofday(&tv, NULL);
|
||||
localtime_r(&tv.tv_sec, &tm);
|
||||
|
||||
vty_out(vty, "%04d-%02d-%02d,%02d:%02d:%02d.%03d%s",
|
||||
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec,
|
||||
(int)(tv.tv_usec / 1000), VTY_NEWLINE);
|
||||
vty_flush(vty);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
static struct cmd_node peer_node = {
|
||||
PEER_NODE,
|
||||
"%s(peer)# ",
|
||||
@@ -1128,12 +1146,14 @@ void pfcp_tool_vty_init_cmds()
|
||||
OSMO_ASSERT(g_pfcp_tool != NULL);
|
||||
|
||||
install_ve_and_config(&c_sleep_cmd);
|
||||
install_ve_and_config(&c_date_cmd);
|
||||
install_ve_and_config(&wait_responses_cmd);
|
||||
|
||||
install_ve_and_config(&peer_cmd);
|
||||
install_node(&peer_node, NULL);
|
||||
|
||||
install_element(PEER_NODE, &c_sleep_cmd);
|
||||
install_element(PEER_NODE, &c_date_cmd);
|
||||
install_element(PEER_NODE, &peer_tx_heartbeat_cmd);
|
||||
install_element(PEER_NODE, &peer_tx_assoc_setup_req_cmd);
|
||||
install_element(PEER_NODE, &peer_retrans_req_cmd);
|
||||
@@ -1144,6 +1164,7 @@ void pfcp_tool_vty_init_cmds()
|
||||
install_element(PEER_NODE, &session_endecaps_cmd);
|
||||
install_node(&session_node, NULL);
|
||||
install_element(SESSION_NODE, &c_sleep_cmd);
|
||||
install_element(SESSION_NODE, &c_date_cmd);
|
||||
install_element(SESSION_NODE, &session_tx_est_req_cmd);
|
||||
install_element(SESSION_NODE, &session_tx_mod_req_cmd);
|
||||
install_element(SESSION_NODE, &session_tx_del_req_cmd);
|
||||
|
Reference in New Issue
Block a user