#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
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;
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"
"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),
(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;
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);
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));
}
/* ================================================== */
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
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:
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
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 */
};
/* ================================================== */
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
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