From 9edb34809349a4949b70b7cb6e225e64c65c7ef7 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 4 Mar 2010 03:49:06 +0000 Subject: [PATCH] read time is only cache misses --- docs/manual.rst | 3 ++- src/disk_io_thread.cpp | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/manual.rst b/docs/manual.rst index 40876c45d..949207937 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -856,7 +856,8 @@ used in peer connections. has to wait in the job queue before it get processed. ``average_read_time`` is the number of microseconds a read job takes to -wait in the queue and complete, in microseconds. +wait in the queue and complete, in microseconds. This only includes +cache misses. ``job_queue_length`` is the number of jobs in the job queue. diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index fbccafaf0..80a37b3cf 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -1868,6 +1868,12 @@ namespace libtorrent break; } ++m_cache_stats.blocks_read; + hit = false; + } + if (!hit) + { + ptime now = time_now_hires(); + m_read_time.add_sample(total_microseconds(now - j.start_time)); } TORRENT_ASSERT(j.buffer == read_holder.get()); read_holder.release(); @@ -2227,8 +2233,6 @@ namespace libtorrent && j.buffer != 0) rename_buffer(j.buffer, "posted send buffer"); #endif - ptime now = time_now_hires(); - m_read_time.add_sample(total_microseconds(now - j.start_time)); post_callback(j.callback, j, ret); #ifndef BOOST_NO_EXCEPTIONS } catch (std::exception&)