* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: xfrin.c,v 1.154 2007/10/31 01:56:47 marka Exp $ */
+/* $Id: xfrin.c,v 1.155 2007/12/02 23:21:19 marka Exp $ */
/*! \file */
isc_boolean_t is_ixfr;
unsigned int nmsg; /*%< Number of messages recvd */
+ unsigned int nrecs; /*%< Number of records recvd */
+ isc_uint64_t nbytes; /*%< Number of bytes received */
+
+ isc_time_t start; /*%< Start time of the transfer */
+ isc_time_t end; /*%< End time of the transfer */
dns_tsigkey_t *tsigkey; /*%< Key used to create TSIG */
isc_buffer_t *lasttsig; /*%< The last TSIG */
{
isc_result_t result;
+ xfr->nrecs++;
+
redo:
switch (xfr->state) {
case XFRST_SOAQUERY:
/* end_serial */
xfr->nmsg = 0;
+ xfr->nrecs = 0;
+ xfr->nbytes = 0;
+ isc_time_now(&xfr->start);
xfr->tsigkey = NULL;
if (tsigkey != NULL)
xfr->checkid = ISC_TRUE;
xfr->id++;
xfr->nmsg = 0;
+ xfr->nrecs = 0;
+ xfr->nbytes = 0;
+ isc_time_now(&xfr->start);
msg->id = xfr->id;
CHECK(render(msg, xfr->mctx, &xfr->qbuffer));
*/
xfr->nmsg++;
+ /*
+ * Update the number of bytes received.
+ */
+ xfr->nbytes += tcpmsg->buffer.used;
+
/*
* Copy the context back.
*/
static void
maybe_free(dns_xfrin_ctx_t *xfr) {
+ isc_uint64_t secs;
+
REQUIRE(VALID_XFRIN(xfr));
if (! xfr->shuttingdown || xfr->refcount != 0 ||
xfr->recvs != 0)
return;
- xfrin_log(xfr, ISC_LOG_INFO, "end of transfer");
+ /*
+ * Calculate the length of time the transfer took,
+ * and print a log message with the bytes and rate.
+ */
+ isc_time_now(&xfr->end);
+ secs = isc_time_microdiff(&xfr->end, &xfr->start) / 1000000;
+ if (secs == 0)
+ secs = 1;
+ xfrin_log(xfr, ISC_LOG_INFO,
+ "Transfer completed: %d messages, %d records, "
+ "%" ISC_PRINT_QUADFORMAT "u bytes, "
+ "%" ISC_PRINT_QUADFORMAT "u secs (%0.1f bytes/sec)",
+ xfr->nmsg, xfr->nrecs, xfr->nbytes, secs,
+ (float) (xfr->nbytes / secs));
if (xfr->socket != NULL)
isc_socket_detach(&xfr->socket);
static void
xfrin_log1(int level, const char *zonetext, isc_sockaddr_t *masteraddr,
- const char *fmt, ...)
+ const char *fmt, ...)
{
va_list ap;