report disk read-back when verifying piece hashes
This commit is contained in:
parent
afc9806319
commit
1b6227ad31
|
@ -179,6 +179,7 @@ namespace libtorrent
|
||||||
, cumulative_write_time(0)
|
, cumulative_write_time(0)
|
||||||
, cumulative_hash_time(0)
|
, cumulative_hash_time(0)
|
||||||
, cumulative_sort_time(0)
|
, cumulative_sort_time(0)
|
||||||
|
, total_read_back(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// the number of 16kB blocks written
|
// the number of 16kB blocks written
|
||||||
|
@ -222,6 +223,7 @@ namespace libtorrent
|
||||||
boost::uint32_t cumulative_write_time;
|
boost::uint32_t cumulative_write_time;
|
||||||
boost::uint32_t cumulative_hash_time;
|
boost::uint32_t cumulative_hash_time;
|
||||||
boost::uint32_t cumulative_sort_time;
|
boost::uint32_t cumulative_sort_time;
|
||||||
|
int total_read_back;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TORRENT_EXPORT disk_buffer_pool : boost::noncopyable
|
struct TORRENT_EXPORT disk_buffer_pool : boost::noncopyable
|
||||||
|
|
|
@ -348,7 +348,7 @@ namespace libtorrent
|
||||||
, int current_slot);
|
, int current_slot);
|
||||||
|
|
||||||
void switch_to_full_mode();
|
void switch_to_full_mode();
|
||||||
sha1_hash hash_for_piece_impl(int piece);
|
sha1_hash hash_for_piece_impl(int piece, int* readback = 0);
|
||||||
|
|
||||||
int release_files_impl() { return m_storage->release_files(); }
|
int release_files_impl() { return m_storage->release_files(); }
|
||||||
int delete_files_impl() { return m_storage->delete_files(); }
|
int delete_files_impl() { return m_storage->delete_files(); }
|
||||||
|
|
|
@ -2190,7 +2190,8 @@ namespace libtorrent
|
||||||
|
|
||||||
ptime hash_start = time_now_hires();
|
ptime hash_start = time_now_hires();
|
||||||
|
|
||||||
sha1_hash h = j.storage->hash_for_piece_impl(j.piece);
|
int readback = 0;
|
||||||
|
sha1_hash h = j.storage->hash_for_piece_impl(j.piece, &readback);
|
||||||
if (test_error(j))
|
if (test_error(j))
|
||||||
{
|
{
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
@ -2198,6 +2199,8 @@ namespace libtorrent
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_cache_stats.total_read_back += readback / m_block_size;
|
||||||
|
|
||||||
ret = (j.storage->info()->hash_for_piece(j.piece) == h)?0:-2;
|
ret = (j.storage->info()->hash_for_piece(j.piece) == h)?0:-2;
|
||||||
if (ret == -2) j.storage->mark_failed(j.piece);
|
if (ret == -2) j.storage->mark_failed(j.piece);
|
||||||
|
|
||||||
|
|
|
@ -964,6 +964,7 @@ namespace aux {
|
||||||
":cumulative write time"
|
":cumulative write time"
|
||||||
":cumulative hash time"
|
":cumulative hash time"
|
||||||
":cumulative sort time"
|
":cumulative sort time"
|
||||||
|
":disk total read back"
|
||||||
"\n\n", m_stats_logger);
|
"\n\n", m_stats_logger);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2739,7 +2740,7 @@ namespace aux {
|
||||||
"%f\t%f\t%f\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t"
|
"%f\t%f\t%f\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t"
|
||||||
"%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t"
|
"%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t"
|
||||||
"%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t"
|
"%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t"
|
||||||
"%d\t%d\t%d\n"
|
"%d\t%d\t%d\t%d\n"
|
||||||
, total_milliseconds(now - m_last_log_rotation) / 1000.f
|
, total_milliseconds(now - m_last_log_rotation) / 1000.f
|
||||||
, int(m_stat.total_upload() - m_last_uploaded)
|
, int(m_stat.total_upload() - m_last_uploaded)
|
||||||
, int(m_stat.total_download() - m_last_downloaded)
|
, int(m_stat.total_download() - m_last_downloaded)
|
||||||
|
@ -2833,6 +2834,7 @@ namespace aux {
|
||||||
, int(cs.cumulative_write_time)
|
, int(cs.cumulative_write_time)
|
||||||
, int(cs.cumulative_hash_time)
|
, int(cs.cumulative_hash_time)
|
||||||
, int(cs.cumulative_sort_time)
|
, int(cs.cumulative_sort_time)
|
||||||
|
, cs.total_read_back
|
||||||
);
|
);
|
||||||
m_last_cache_status = cs;
|
m_last_cache_status = cs;
|
||||||
m_last_failed = m_total_failed_bytes;
|
m_last_failed = m_total_failed_bytes;
|
||||||
|
|
|
@ -1710,7 +1710,7 @@ ret:
|
||||||
return m_save_path;
|
return m_save_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
sha1_hash piece_manager::hash_for_piece_impl(int piece)
|
sha1_hash piece_manager::hash_for_piece_impl(int piece, int* readback)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(!m_storage->error());
|
TORRENT_ASSERT(!m_storage->error());
|
||||||
|
|
||||||
|
@ -1725,7 +1725,8 @@ ret:
|
||||||
|
|
||||||
int slot = slot_for(piece);
|
int slot = slot_for(piece);
|
||||||
TORRENT_ASSERT(slot != has_no_slot);
|
TORRENT_ASSERT(slot != has_no_slot);
|
||||||
hash_for_slot(slot, ph, m_files.piece_size(piece));
|
int read = hash_for_slot(slot, ph, m_files.piece_size(piece));
|
||||||
|
if (readback) *readback = read;
|
||||||
if (m_storage->error()) return sha1_hash(0);
|
if (m_storage->error()) return sha1_hash(0);
|
||||||
return ph.h.final();
|
return ph.h.final();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue