forked from premiere/premiere-libtorrent
fix docs generation for stats counters
This commit is contained in:
parent
f0be98ce53
commit
671ae32ae5
|
@ -1,3 +1,36 @@
|
|||
counter_types = {}
|
||||
|
||||
f = open('../include/libtorrent/performance_counters.hpp')
|
||||
|
||||
counter_type = ''
|
||||
|
||||
for l in f:
|
||||
l = l.strip()
|
||||
|
||||
if l.startswith('//'): continue
|
||||
if l.startswith('#'): continue
|
||||
if l == '': continue
|
||||
|
||||
if 'enum stats_counter_t' in l:
|
||||
counter_type = 'counter'
|
||||
continue
|
||||
|
||||
if 'enum stats_gauges_t' in l:
|
||||
counter_type = 'gauge'
|
||||
continue
|
||||
|
||||
if '{' in l or '}' in l or 'struct' in l or 'namespace' in l: continue
|
||||
if counter_type == '': continue
|
||||
if not l.endswith(','): continue
|
||||
|
||||
# strip off trailing comma
|
||||
l = l[:-1]
|
||||
if '=' in l: l = l[:l.index('=')].strip()
|
||||
|
||||
counter_types[l] = counter_type
|
||||
|
||||
f.close()
|
||||
|
||||
f = open('../src/session_stats.cpp')
|
||||
|
||||
out = open('stats_counters.rst', 'w+')
|
||||
|
@ -61,14 +94,12 @@ for l in f:
|
|||
|
||||
# args: category, name, type
|
||||
|
||||
args[1] = args[1].strip()
|
||||
names.append(args[0].strip() + '.' + args[1].strip())
|
||||
|
||||
# strip type_ prefix of type_gauge and type_counter
|
||||
args[2] = args[2].strip()[5:]
|
||||
types.append(args[2])
|
||||
types.append(counter_types[args[1]])
|
||||
|
||||
if len(names) > 0:
|
||||
render_section(names, decsription, types)
|
||||
render_section(names, description, types)
|
||||
|
||||
out.close()
|
||||
f.close()
|
||||
|
|
|
@ -3,12 +3,12 @@ import os
|
|||
|
||||
paths = ['src/*.cpp', 'src/kademlia/*.cpp', 'include/libtorrent/*.hpp', 'include/libtorrent/kademlia/*.hpp', 'include/libtorrent/aux_/*.hpp', 'include/libtorrent/extensions/*.hpp']
|
||||
|
||||
os.system('ctags %s 2>/dev/null' % ' '.join(paths))
|
||||
os.system('(cd .. ; ctags %s 2>/dev/null)' % ' '.join(paths))
|
||||
|
||||
files = []
|
||||
|
||||
for p in paths:
|
||||
files.extend(glob.glob(p))
|
||||
files.extend(glob.glob(os.path.join('..', p)))
|
||||
|
||||
items = []
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ all: html
|
|||
settings.rst: ../include/libtorrent/settings_pack.hpp
|
||||
python gen_settings_doc.py
|
||||
|
||||
stats_counters.rst: ../src/session_stats.cpp
|
||||
stats_counters.rst: ../src/session_stats.cpp ../include/libtorrent/performance_counters.hpp
|
||||
python gen_stats_doc.py
|
||||
|
||||
manual.rst: stats_counters.rst
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
+-------------------------+---------+
|
||||
|
||||
|
||||
TODO: 3 the type of counter does not need to be stored in this array.
|
||||
when the user asks for the list of counters, that field could be
|
||||
generated based on the range of the counter index.
|
||||
``error_peers`` is the total number of peer disconnects
|
||||
caused by an error (not initiated by this client) and
|
||||
disconnected initiated by this client (``disconnected_peers``).
|
||||
|
@ -950,24 +953,6 @@ the number of pieces considered while picking pieces
|
|||
|
||||
.. _disk.read_cache_blocks:
|
||||
|
||||
.. _disk.pinned_blocks:
|
||||
|
||||
.. _disk.disk_blocks_in_use:
|
||||
|
||||
.. _disk.queued_disk_jobs:
|
||||
|
||||
.. _disk.num_read_jobs:
|
||||
|
||||
.. _disk.num_write_jobs:
|
||||
|
||||
.. _disk.num_jobs:
|
||||
|
||||
.. _disk.num_writing_threads:
|
||||
|
||||
.. _disk.num_running_threads:
|
||||
|
||||
.. _disk.blocked_disk_jobs:
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<a name="picker.reject_piece_picks"></a>
|
||||
|
@ -980,15 +965,6 @@ the number of pieces considered while picking pieces
|
|||
<a name="picker.hash_fail_piece_picks"></a>
|
||||
<a name="disk.write_cache_blocks"></a>
|
||||
<a name="disk.read_cache_blocks"></a>
|
||||
<a name="disk.pinned_blocks"></a>
|
||||
<a name="disk.disk_blocks_in_use"></a>
|
||||
<a name="disk.queued_disk_jobs"></a>
|
||||
<a name="disk.num_read_jobs"></a>
|
||||
<a name="disk.num_write_jobs"></a>
|
||||
<a name="disk.num_jobs"></a>
|
||||
<a name="disk.num_writing_threads"></a>
|
||||
<a name="disk.num_running_threads"></a>
|
||||
<a name="disk.blocked_disk_jobs"></a>
|
||||
|
||||
+---------------------------------------+---------+
|
||||
| name | type |
|
||||
|
@ -1013,29 +989,72 @@ the number of pieces considered while picking pieces
|
|||
+---------------------------------------+---------+
|
||||
| disk.read_cache_blocks | gauge |
|
||||
+---------------------------------------+---------+
|
||||
| disk.pinned_blocks | gauge |
|
||||
+---------------------------------------+---------+
|
||||
| disk.disk_blocks_in_use | gauge |
|
||||
+---------------------------------------+---------+
|
||||
| disk.queued_disk_jobs | gauge |
|
||||
+---------------------------------------+---------+
|
||||
| disk.num_read_jobs | gauge |
|
||||
+---------------------------------------+---------+
|
||||
| disk.num_write_jobs | gauge |
|
||||
+---------------------------------------+---------+
|
||||
| disk.num_jobs | gauge |
|
||||
+---------------------------------------+---------+
|
||||
| disk.num_writing_threads | gauge |
|
||||
+---------------------------------------+---------+
|
||||
| disk.num_running_threads | gauge |
|
||||
+---------------------------------------+---------+
|
||||
| disk.blocked_disk_jobs | gauge |
|
||||
+---------------------------------------+---------+
|
||||
|
||||
|
||||
This breaks down the piece picks into the event that
|
||||
triggered it
|
||||
|
||||
.. _disk.request_latency:
|
||||
|
||||
.. _disk.pinned_blocks:
|
||||
|
||||
.. _disk.disk_blocks_in_use:
|
||||
|
||||
.. _disk.queued_disk_jobs:
|
||||
|
||||
.. _disk.num_read_jobs:
|
||||
|
||||
.. _disk.num_write_jobs:
|
||||
|
||||
.. _disk.num_jobs:
|
||||
|
||||
.. _disk.num_writing_threads:
|
||||
|
||||
.. _disk.num_running_threads:
|
||||
|
||||
.. _disk.blocked_disk_jobs:
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<a name="disk.request_latency"></a>
|
||||
<a name="disk.pinned_blocks"></a>
|
||||
<a name="disk.disk_blocks_in_use"></a>
|
||||
<a name="disk.queued_disk_jobs"></a>
|
||||
<a name="disk.num_read_jobs"></a>
|
||||
<a name="disk.num_write_jobs"></a>
|
||||
<a name="disk.num_jobs"></a>
|
||||
<a name="disk.num_writing_threads"></a>
|
||||
<a name="disk.num_running_threads"></a>
|
||||
<a name="disk.blocked_disk_jobs"></a>
|
||||
|
||||
+--------------------------+-------+
|
||||
| name | type |
|
||||
+==========================+=======+
|
||||
| disk.request_latency | gauge |
|
||||
+--------------------------+-------+
|
||||
| disk.pinned_blocks | gauge |
|
||||
+--------------------------+-------+
|
||||
| disk.disk_blocks_in_use | gauge |
|
||||
+--------------------------+-------+
|
||||
| disk.queued_disk_jobs | gauge |
|
||||
+--------------------------+-------+
|
||||
| disk.num_read_jobs | gauge |
|
||||
+--------------------------+-------+
|
||||
| disk.num_write_jobs | gauge |
|
||||
+--------------------------+-------+
|
||||
| disk.num_jobs | gauge |
|
||||
+--------------------------+-------+
|
||||
| disk.num_writing_threads | gauge |
|
||||
+--------------------------+-------+
|
||||
| disk.num_running_threads | gauge |
|
||||
+--------------------------+-------+
|
||||
| disk.blocked_disk_jobs | gauge |
|
||||
+--------------------------+-------+
|
||||
|
||||
|
||||
the number of microseconds it takes from receiving a request from a
|
||||
peer until we're sending the response back on the socket.
|
||||
|
||||
.. _disk.queued_write_bytes:
|
||||
|
||||
.. _disk.arc_mru_size:
|
||||
|
@ -1142,6 +1161,47 @@ bytes just hanging out in the cache)
|
|||
cumulative time spent in various disk jobs, as well
|
||||
as total for all disk jobs. Measured in microseconds
|
||||
|
||||
.. _ses.waste_piece_timed_out:
|
||||
|
||||
.. _ses.waste_piece_cancelled:
|
||||
|
||||
.. _ses.waste_piece_unknown:
|
||||
|
||||
.. _ses.waste_piece_seed:
|
||||
|
||||
.. _ses.waste_piece_end_game:
|
||||
|
||||
.. _ses.waste_piece_closing:
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<a name="ses.waste_piece_timed_out"></a>
|
||||
<a name="ses.waste_piece_cancelled"></a>
|
||||
<a name="ses.waste_piece_unknown"></a>
|
||||
<a name="ses.waste_piece_seed"></a>
|
||||
<a name="ses.waste_piece_end_game"></a>
|
||||
<a name="ses.waste_piece_closing"></a>
|
||||
|
||||
+---------------------------+---------+
|
||||
| name | type |
|
||||
+===========================+=========+
|
||||
| ses.waste_piece_timed_out | counter |
|
||||
+---------------------------+---------+
|
||||
| ses.waste_piece_cancelled | counter |
|
||||
+---------------------------+---------+
|
||||
| ses.waste_piece_unknown | counter |
|
||||
+---------------------------+---------+
|
||||
| ses.waste_piece_seed | counter |
|
||||
+---------------------------+---------+
|
||||
| ses.waste_piece_end_game | counter |
|
||||
+---------------------------+---------+
|
||||
| ses.waste_piece_closing | counter |
|
||||
+---------------------------+---------+
|
||||
|
||||
|
||||
the number of wasted downloaded bytes by reason of the bytes being
|
||||
wasted.
|
||||
|
||||
.. _dht.dht_nodes:
|
||||
|
||||
.. raw:: html
|
||||
|
@ -1442,7 +1502,8 @@ by kind.
|
|||
+------------------------------+---------+
|
||||
|
||||
|
||||
uTP counters
|
||||
uTP counters. Each counter represents the number of time each event
|
||||
has occurred.
|
||||
|
||||
.. _sock_bufs.socket_send_size3:
|
||||
|
||||
|
|
|
@ -302,7 +302,8 @@ namespace libtorrent
|
|||
{
|
||||
num_checking_torrents = num_stats_counters,
|
||||
num_stopped_torrents,
|
||||
num_upload_only_torrents, // i.e. finished
|
||||
// upload_only means finished
|
||||
num_upload_only_torrents,
|
||||
num_downloading_torrents,
|
||||
num_seeding_torrents,
|
||||
num_queued_seeding_torrents,
|
||||
|
|
|
@ -2780,6 +2780,9 @@ namespace libtorrent
|
|||
{
|
||||
// These are atomic_counts, so it's safe to access them from
|
||||
// a different thread
|
||||
|
||||
// TODO: 3 instead of updating these counters in this function,
|
||||
// they could be updated every time a job completes
|
||||
c.set_value(counters::disk_read_time, m_cache_stats.cumulative_read_time);
|
||||
c.set_value(counters::disk_write_time, m_cache_stats.cumulative_write_time);
|
||||
c.set_value(counters::disk_hash_time, m_cache_stats.cumulative_hash_time);
|
||||
|
|
|
@ -386,7 +386,8 @@ namespace libtorrent
|
|||
METRIC(dht, dht_put_in)
|
||||
METRIC(dht, dht_put_out)
|
||||
|
||||
// uTP counters
|
||||
// uTP counters. Each counter represents the number of time each event
|
||||
// has occurred.
|
||||
METRIC(utp, utp_packet_loss)
|
||||
METRIC(utp, utp_timeout)
|
||||
METRIC(utp, utp_packets_in)
|
||||
|
|
Loading…
Reference in New Issue