cmdmon: add timestamp counters to serverstats report
Add the new RX/TX daemon/kernel/hardware timestamp counters to the serverstats report.
This commit is contained in:
parent
2f961ab36a
commit
0845df7684
8 changed files with 79 additions and 11 deletions
10
candm.h
10
candm.h
|
@ -530,7 +530,8 @@ typedef struct {
|
|||
#define RPY_SERVER_STATS2 22
|
||||
#define RPY_SELECT_DATA 23
|
||||
#define RPY_SERVER_STATS3 24
|
||||
#define N_REPLY_TYPES 25
|
||||
#define RPY_SERVER_STATS4 25
|
||||
#define N_REPLY_TYPES 26
|
||||
|
||||
/* Status codes */
|
||||
#define STT_SUCCESS 0
|
||||
|
@ -676,6 +677,13 @@ typedef struct {
|
|||
uint32_t ntp_interleaved_hits;
|
||||
uint32_t ntp_timestamps;
|
||||
uint32_t ntp_span_seconds;
|
||||
uint32_t ntp_daemon_rx_timestamps;
|
||||
uint32_t ntp_daemon_tx_timestamps;
|
||||
uint32_t ntp_kernel_rx_timestamps;
|
||||
uint32_t ntp_kernel_tx_timestamps;
|
||||
uint32_t ntp_hw_rx_timestamps;
|
||||
uint32_t ntp_hw_tx_timestamps;
|
||||
uint32_t reserved[4];
|
||||
int32_t EOR;
|
||||
} RPY_ServerStats;
|
||||
|
||||
|
|
16
client.c
16
client.c
|
@ -2478,7 +2478,7 @@ process_cmd_serverstats(char *line)
|
|||
CMD_Reply reply;
|
||||
|
||||
request.command = htons(REQ_SERVER_STATS);
|
||||
if (!request_reply(&request, &reply, RPY_SERVER_STATS3, 0))
|
||||
if (!request_reply(&request, &reply, RPY_SERVER_STATS4, 0))
|
||||
return 0;
|
||||
|
||||
print_report("NTP packets received : %U\n"
|
||||
|
@ -2491,7 +2491,13 @@ process_cmd_serverstats(char *line)
|
|||
"Authenticated NTP packets : %U\n"
|
||||
"Interleaved NTP packets : %U\n"
|
||||
"NTP timestamps held : %U\n"
|
||||
"NTP timestamp span : %U\n",
|
||||
"NTP timestamp span : %U\n"
|
||||
"NTP daemon RX timestamps : %U\n"
|
||||
"NTP daemon TX timestamps : %U\n"
|
||||
"NTP kernel RX timestamps : %U\n"
|
||||
"NTP kernel TX timestamps : %U\n"
|
||||
"NTP hardware RX timestamps : %U\n"
|
||||
"NTP hardware TX timestamps : %U\n",
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_hits),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_drops),
|
||||
(unsigned long)ntohl(reply.data.server_stats.cmd_hits),
|
||||
|
@ -2503,6 +2509,12 @@ process_cmd_serverstats(char *line)
|
|||
(unsigned long)ntohl(reply.data.server_stats.ntp_interleaved_hits),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_timestamps),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_span_seconds),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_daemon_rx_timestamps),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_daemon_tx_timestamps),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_kernel_rx_timestamps),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_kernel_tx_timestamps),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_hw_rx_timestamps),
|
||||
(unsigned long)ntohl(reply.data.server_stats.ntp_hw_tx_timestamps),
|
||||
REPORT_END);
|
||||
|
||||
return 1;
|
||||
|
|
10
cmdmon.c
10
cmdmon.c
|
@ -1177,7 +1177,7 @@ handle_server_stats(CMD_Request *rx_message, CMD_Reply *tx_message)
|
|||
RPT_ServerStatsReport report;
|
||||
|
||||
CLG_GetServerStatsReport(&report);
|
||||
tx_message->reply = htons(RPY_SERVER_STATS3);
|
||||
tx_message->reply = htons(RPY_SERVER_STATS4);
|
||||
tx_message->data.server_stats.ntp_hits = htonl(report.ntp_hits);
|
||||
tx_message->data.server_stats.nke_hits = htonl(report.nke_hits);
|
||||
tx_message->data.server_stats.cmd_hits = htonl(report.cmd_hits);
|
||||
|
@ -1189,6 +1189,14 @@ handle_server_stats(CMD_Request *rx_message, CMD_Reply *tx_message)
|
|||
tx_message->data.server_stats.ntp_interleaved_hits = htonl(report.ntp_interleaved_hits);
|
||||
tx_message->data.server_stats.ntp_timestamps = htonl(report.ntp_timestamps);
|
||||
tx_message->data.server_stats.ntp_span_seconds = htonl(report.ntp_span_seconds);
|
||||
tx_message->data.server_stats.ntp_daemon_rx_timestamps = htonl(report.ntp_daemon_rx_timestamps);
|
||||
tx_message->data.server_stats.ntp_daemon_tx_timestamps = htonl(report.ntp_daemon_tx_timestamps);
|
||||
tx_message->data.server_stats.ntp_kernel_rx_timestamps = htonl(report.ntp_kernel_rx_timestamps);
|
||||
tx_message->data.server_stats.ntp_kernel_tx_timestamps = htonl(report.ntp_kernel_tx_timestamps);
|
||||
tx_message->data.server_stats.ntp_hw_rx_timestamps = htonl(report.ntp_hw_rx_timestamps);
|
||||
tx_message->data.server_stats.ntp_hw_tx_timestamps = htonl(report.ntp_hw_tx_timestamps);
|
||||
memset(tx_message->data.server_stats.reserved, 0xff,
|
||||
sizeof (tx_message->data.server_stats.reserved));
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
|
|
@ -2536,10 +2536,13 @@ physical clock created by writing to _/sys/class/ptp/ptpX/n_vclocks_. This
|
|||
feature is available on Linux 5.14 and newer.
|
||||
+
|
||||
If the kernel supports software timestamping, it will be enabled for all
|
||||
interfaces. The source of timestamps (i.e. hardware, kernel, or daemon) is
|
||||
indicated in the _measurements.log_ file if enabled by the <<log,*log
|
||||
measurements*>> directive, and the <<chronyc.adoc#ntpdata,*ntpdata*>> report in
|
||||
*chronyc*.
|
||||
interfaces automatically.
|
||||
+
|
||||
The source of timestamps (i.e. hardware, kernel, or daemon) is indicated on the
|
||||
client side in the _measurements.log_ file (if enabled by the <<log,*log*>>
|
||||
directive) and the <<chronyc.adoc#ntpdata,*ntpdata*>> report. On the server
|
||||
side, the number of served timestamps from each source is provided in the
|
||||
<<chronyc.adoc#serverstats,*serverstats*>> report.
|
||||
+
|
||||
This directive can be used multiple times to enable HW timestamping on multiple
|
||||
interfaces. If the specified interface is _*_, *chronyd* will try to enable HW
|
||||
|
|
|
@ -1158,6 +1158,12 @@ Authenticated NTP packets : 189
|
|||
Interleaved NTP packets : 43
|
||||
NTP timestamps held : 44
|
||||
NTP timestamp span : 120
|
||||
NTP daemon RX timestamps : 0
|
||||
NTP daemon TX timestamps : 1537
|
||||
NTP kernel RX timestamps : 1590
|
||||
NTP kernel TX timestamps : 43
|
||||
NTP hardware RX timestamps : 0
|
||||
NTP hardware TX timestamps : 0
|
||||
----
|
||||
+
|
||||
The fields have the following meaning:
|
||||
|
@ -1192,6 +1198,24 @@ The number of pairs of receive and transmit timestamps that the server is
|
|||
currently holding in memory for clients using the interleaved mode.
|
||||
*NTP timestamp span*:::
|
||||
The interval (in seconds) covered by the currently held NTP timestamps.
|
||||
*NTP daemon RX timestamps*:::
|
||||
The number of NTP responses which included a receive timestamp captured by the
|
||||
daemon.
|
||||
*NTP daemon TX timestamps*:::
|
||||
The number of NTP responses which included a transmit timestamp captured by the
|
||||
daemon.
|
||||
*NTP kernel RX timestamps*:::
|
||||
The number of NTP responses which included a receive timestamp captured by the
|
||||
kernel.
|
||||
*NTP kernel TX timestamps*:::
|
||||
The number of NTP responses (in the interleaved mode) which included a transmit
|
||||
timestamp captured by the kernel.
|
||||
*NTP hardware RX timestamps*:::
|
||||
The number of NTP responses which included a receive timestamp captured by the
|
||||
NIC.
|
||||
*NTP hardware TX timestamps*:::
|
||||
The number of NTP responses (in the interleaved mode) which included a transmit
|
||||
timestamp captured by the NIC.
|
||||
{blank}::
|
||||
+
|
||||
Note that the numbers reported by this command overflow to zero after
|
||||
|
|
|
@ -157,7 +157,8 @@ static const uint16_t reply_lengths[] = {
|
|||
RPY_LENGTH_ENTRY(client_accesses_by_index), /* CLIENT_ACCESSES_BY_INDEX3 */
|
||||
0, /* SERVER_STATS2 - not supported */
|
||||
RPY_LENGTH_ENTRY(select_data), /* SELECT_DATA */
|
||||
RPY_LENGTH_ENTRY(server_stats), /* SERVER_STATS3 */
|
||||
0, /* SERVER_STATS3 - not supported */
|
||||
RPY_LENGTH_ENTRY(server_stats), /* SERVER_STATS4 */
|
||||
};
|
||||
|
||||
/* ================================================== */
|
||||
|
|
|
@ -260,7 +260,13 @@ NTS-KE connections dropped : 0
|
|||
Authenticated NTP packets : 0
|
||||
Interleaved NTP packets : 0
|
||||
NTP timestamps held : 0
|
||||
NTP timestamp span : 0$" || test_fail
|
||||
NTP timestamp span : 0
|
||||
NTP daemon RX timestamps : 0
|
||||
NTP daemon TX timestamps : 1
|
||||
NTP kernel RX timestamps : 1
|
||||
NTP kernel TX timestamps : 0
|
||||
NTP hardware RX timestamps : 0
|
||||
NTP hardware TX timestamps : 0$" || test_fail
|
||||
|
||||
chronyc_conf="
|
||||
deny all
|
||||
|
|
|
@ -115,7 +115,13 @@ NTS-KE connections dropped : 0
|
|||
Authenticated NTP packets : 0
|
||||
Interleaved NTP packets : 0
|
||||
NTP timestamps held : 0
|
||||
NTP timestamp span : 0$"|| test_fail
|
||||
NTP timestamp span : 0
|
||||
NTP daemon RX timestamps : 0
|
||||
NTP daemon TX timestamps : [0-9]+
|
||||
NTP kernel RX timestamps : [0-9]+
|
||||
NTP kernel TX timestamps : 0
|
||||
NTP hardware RX timestamps : 0
|
||||
NTP hardware TX timestamps : 0$"|| test_fail
|
||||
|
||||
run_chronyc "manual on" || test_fail
|
||||
check_chronyc_output "^200 OK$" || test_fail
|
||||
|
|
Loading…
Reference in a new issue