forked from premiere/premiere-libtorrent
cleaned up redundant bytes and failed bytes counters. moved some into the stats_counters
This commit is contained in:
parent
ab8c1eb334
commit
7c9c25e359
|
@ -594,22 +594,6 @@ namespace libtorrent
|
|||
|
||||
int next_port() const;
|
||||
|
||||
void add_redundant_bytes(size_type b, int reason)
|
||||
{
|
||||
TORRENT_ASSERT(b > 0);
|
||||
// TODO: 3 the m_redundant_bytes array should be made part of
|
||||
// the stats counters. That way another session_impl dependency
|
||||
// from the peer connections would be removed
|
||||
m_redundant_bytes[reason] += b;
|
||||
m_stats_counters.inc_stats_counter(counters::recv_redundant_bytes, b);
|
||||
}
|
||||
|
||||
void add_failed_bytes(size_type b)
|
||||
{
|
||||
TORRENT_ASSERT(b > 0);
|
||||
m_stats_counters.inc_stats_counter(counters::recv_failed_bytes, b);
|
||||
}
|
||||
|
||||
// load the specified torrent, also
|
||||
// pick the least recently used torrent and unload it, unless
|
||||
// t is the least recently used, then the next least recently
|
||||
|
@ -1297,10 +1281,6 @@ namespace libtorrent
|
|||
// is true if the session is paused
|
||||
bool m_paused;
|
||||
|
||||
// redundant bytes per category
|
||||
// TODO: 3 turn this into a stats_counter
|
||||
size_type m_redundant_bytes[7];
|
||||
|
||||
std::vector<boost::shared_ptr<feed> > m_feeds;
|
||||
|
||||
// this is a list of peer connections who have been
|
||||
|
|
|
@ -130,9 +130,6 @@ namespace libtorrent { namespace aux
|
|||
virtual bool has_connection(peer_connection* p) const = 0;
|
||||
virtual void insert_peer(boost::shared_ptr<peer_connection> const& c) = 0;
|
||||
|
||||
virtual void add_redundant_bytes(size_type b, int reason) = 0;
|
||||
virtual void add_failed_bytes(size_type b) = 0;
|
||||
|
||||
virtual void queue_async_resume_data(boost::shared_ptr<torrent> const& t) = 0;
|
||||
virtual void done_async_resume() = 0;
|
||||
virtual void evict_torrent(torrent* t) = 0;
|
||||
|
|
|
@ -187,6 +187,13 @@ namespace libtorrent
|
|||
disk_hash_time,
|
||||
disk_job_time,
|
||||
|
||||
waste_piece_timed_out,
|
||||
waste_piece_cancelled,
|
||||
waste_piece_unknown,
|
||||
waste_piece_seed,
|
||||
waste_piece_end_game,
|
||||
waste_piece_closing,
|
||||
|
||||
sent_payload_bytes,
|
||||
sent_bytes,
|
||||
sent_ip_overhead_bytes,
|
||||
|
|
|
@ -864,7 +864,8 @@ namespace libtorrent
|
|||
|
||||
enum wasted_reason_t
|
||||
{
|
||||
piece_timed_out, piece_cancelled, piece_unknown, piece_seed, piece_end_game, piece_closing
|
||||
piece_timed_out, piece_cancelled, piece_unknown, piece_seed
|
||||
, piece_end_game, piece_closing
|
||||
, waste_reason_max
|
||||
};
|
||||
void add_redundant_bytes(int b, wasted_reason_t reason);
|
||||
|
@ -1237,6 +1238,9 @@ namespace libtorrent
|
|||
// peers. This vector is ordered, to make lookups fast.
|
||||
std::vector<int> m_predictive_pieces;
|
||||
|
||||
// the performance counters of this session
|
||||
counters& m_stats_counters;
|
||||
|
||||
// each bit represents a piece. a set bit means
|
||||
// the piece has had its hash verified. This
|
||||
// is only used in seed mode (when m_seed_mode
|
||||
|
|
|
@ -516,7 +516,6 @@ namespace aux {
|
|||
#if TORRENT_USE_ASSERTS
|
||||
m_posting_torrent_updates = false;
|
||||
#endif
|
||||
memset(m_redundant_bytes, 0, sizeof(m_redundant_bytes));
|
||||
m_udp_socket.set_rate_limit(m_settings.get_int(settings_pack::dht_upload_rate_limit));
|
||||
|
||||
m_udp_socket.subscribe(&m_tracker_manager);
|
||||
|
@ -4264,12 +4263,12 @@ retry:
|
|||
- m_network_thread_cpu_usage.user_time))
|
||||
/ double(tick_interval_ms * 10));
|
||||
|
||||
for (int i = 0; i < torrent::waste_reason_max; ++i)
|
||||
{
|
||||
STAT_LOG(f, (m_redundant_bytes[i] * 100.)
|
||||
/ double(m_stats_counters[counters::recv_redundant_bytes] == 0 ? 1
|
||||
: m_stats_counters[counters::recv_redundant_bytes]));
|
||||
}
|
||||
STAT_COUNTER(waste_piece_timed_out);
|
||||
STAT_COUNTER(waste_piece_cancelled);
|
||||
STAT_COUNTER(waste_piece_unknown);
|
||||
STAT_COUNTER(waste_piece_seed);
|
||||
STAT_COUNTER(waste_piece_end_game);
|
||||
STAT_COUNTER(waste_piece_closing);
|
||||
|
||||
STAT_COUNTER(no_memory_peers);
|
||||
STAT_COUNTER(too_many_peers);
|
||||
|
|
|
@ -330,6 +330,15 @@ namespace libtorrent
|
|||
METRIC(disk, disk_hash_time, type_counter)
|
||||
METRIC(disk, disk_job_time, type_counter)
|
||||
|
||||
// the number of wasted downloaded bytes by reason of the bytes being
|
||||
// wasted.
|
||||
METRIC(ses, waste_piece_timed_out, type_counter)
|
||||
METRIC(ses, waste_piece_cancelled, type_counter)
|
||||
METRIC(ses, waste_piece_unknown, type_counter)
|
||||
METRIC(ses, waste_piece_seed, type_counter)
|
||||
METRIC(ses, waste_piece_end_game, type_counter)
|
||||
METRIC(ses, waste_piece_closing, type_counter)
|
||||
|
||||
// The number of nodes in the DHT routing table
|
||||
METRIC(dht, dht_nodes, type_gauge)
|
||||
|
||||
|
|
|
@ -152,6 +152,7 @@ namespace libtorrent
|
|||
, m_total_uploaded(0)
|
||||
, m_total_downloaded(0)
|
||||
, m_tracker_timer(ses.get_io_service())
|
||||
, m_stats_counters(ses.stats_counters())
|
||||
, m_host_resolver(ses.get_io_service())
|
||||
, m_trackerid(p.trackerid)
|
||||
, m_save_path(complete(p.save_path))
|
||||
|
@ -11216,9 +11217,12 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(m_ses.is_single_thread());
|
||||
TORRENT_ASSERT(b > 0);
|
||||
m_total_redundant_bytes += b;
|
||||
m_ses.add_redundant_bytes(b, reason);
|
||||
// TORRENT_ASSERT(m_total_redundant_bytes + m_total_failed_bytes
|
||||
// <= m_stat.total_payload_download());
|
||||
|
||||
TORRENT_ASSERT(b > 0);
|
||||
TORRENT_ASSERT(reason >= 0);
|
||||
TORRENT_ASSERT(reason < waste_reason_max);
|
||||
m_stats_counters.inc_stats_counter(counters::recv_redundant_bytes, b);
|
||||
m_stats_counters.inc_stats_counter(counters::waste_piece_timed_out + reason, b);
|
||||
}
|
||||
|
||||
void torrent::add_failed_bytes(int b)
|
||||
|
@ -11226,9 +11230,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(m_ses.is_single_thread());
|
||||
TORRENT_ASSERT(b > 0);
|
||||
m_total_failed_bytes += b;
|
||||
m_ses.add_failed_bytes(b);
|
||||
// TORRENT_ASSERT(m_total_redundant_bytes + m_total_failed_bytes
|
||||
// <= m_stat.total_payload_download());
|
||||
m_stats_counters.inc_stats_counter(counters::recv_failed_bytes, b);
|
||||
}
|
||||
|
||||
int torrent::num_seeds() const
|
||||
|
|
|
@ -284,7 +284,7 @@ reports = [
|
|||
('disk_write_time', 'write time', 's', 'distribution of write jobs timing', ['disk write time'], {'type': histogram, 'binwidth': 0.1, 'numbins': 400}),
|
||||
('disk_read_time', 'read time', 's', 'distribution of read jobs timing', ['disk read time'], {'type': histogram, 'binwidth': 0.1, 'numbins': 400}),
|
||||
('waste', '% of all downloaded bytes', '%%', 'proportion of all downloaded bytes that were wasted', ['% failed payload bytes', '% wasted payload bytes', '% protocol bytes'], {'type':stacked}),
|
||||
('waste by source', '% of all wasted bytes', '%%', 'what\' causing the waste', [ 'redundant timed-out', 'redundant cancelled', 'redundant unknown', 'redundant seed', 'redundant end-game', 'redundant closing'], {'type':stacked}),
|
||||
('waste by source', 'num wasted bytes', 'B', 'what is causing the waste', [ 'redundant timed-out', 'redundant cancelled', 'redundant unknown', 'redundant seed', 'redundant end-game', 'redundant closing'], {'type':stacked}),
|
||||
('average_disk_time_absolute', 'job time', 's', 'running averages of timings of disk operations', ['disk read time', 'disk write time', 'disk hash time']),
|
||||
('disk_time', '% of total disk job time', '%%', 'proportion of time spent by the disk thread', ['% read time', '% write time', '% hash time'], {'type': stacked}),
|
||||
('disk_cache_hits', 'blocks (16kiB)', '', '', ['disk block read', 'read cache hits'], {'type':stacked}),
|
||||
|
|
Loading…
Reference in New Issue