Skip to content

Commit

Permalink
measure disk cache size in performance counters
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Nov 2, 2024
1 parent 6a08b55 commit 4e9d240
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/libtorrent/performance_counters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ namespace libtorrent {
request_latency,

disk_blocks_in_use,
disk_cache_pieces,
queued_disk_jobs,
num_running_disk_jobs,
num_read_jobs,
Expand Down
1 change: 1 addition & 0 deletions src/pread_disk_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,7 @@ void pread_disk_io::update_stats_counters(counters& c) const

// gauges
c.set_value(counters::disk_blocks_in_use, m_buffer_pool.in_use());
c.set_value(counters::disk_cache_pieces, m_cache.size());
}

status_t pread_disk_io::do_job(aux::job::file_priority& a, aux::pread_disk_job* j)
Expand Down
1 change: 1 addition & 0 deletions src/session_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ namespace {
METRIC(disk, request_latency)

METRIC(disk, disk_blocks_in_use)
METRIC(disk, disk_cache_pieces)

// ``queued_disk_jobs`` is the number of disk jobs currently queued,
// waiting to be executed by a disk thread.
Expand Down
4 changes: 4 additions & 0 deletions tools/parse_session_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,10 @@ def gen_html(reports, generations):
('queued_trackers', 'number of queued tracker announces', '', '', [ \
'tracker.num_queued_tracker_announces' \
]),
('disk_cache', 'disk cache size', '', '', [ \
'disk.disk_cache_pieces', \
'disk.disk_blocks_in_use', \
]),

# ('picker_full_partials_distribution', 'full pieces', '', '', ['num full partial pieces'],
# {'type': histogram, 'binwidth': 5, 'numbins': 120}),
Expand Down

0 comments on commit 4e9d240

Please sign in to comment.