libtorrent
Description: A feature complete BitTorrent protocol implementation as a C++ library

Version: | 2.0.10

home

Table of contents

- stats_metric
- counters
  - operator[]() inc_stats_counter()
- session_stats_metrics()
- find_metric_idx()
- enum metric_type_t

[report issue]

# stats_metric

Declared in "libtorrent/session_stats.hpp"

describes one statistics metric from the session. For more information, see the session statistics section.

    struct stats_metric
    {
       char const* name;
       int value_index;
       metric_type_t type;
    };

[report issue]

name
  the name of the counter or gauge

[report issue]

value_index type
  the index into the session stats array, where the underlying value of this counter or gauge is found. The session stats array is part of the session_stats_alert object.

[report issue]

# counters

Declared in "libtorrent/performance_counters.hpp"

    struct counters
    {
       counters () ;
       counters (counters const&) ;
       counters& operator= (counters const&) & ;
       std::int64_t inc_stats_counter (int c, std::int64_t value = 1) ;
       std::int64_t operator[] (int i) const ;
       void blend_stats_counter (int c, std::int64_t value, int ratio) ;
       void set_value (int c, std::int64_t value) ;
    };

[report issue]

## operator[]() inc_stats_counter()

    std::int64_t inc_stats_counter (int c, std::int64_t value = 1) ;
    std::int64_t operator[] (int i) const ;

returns the new value

[report issue]

# session_stats_metrics()

Declared in "libtorrent/session_stats.hpp"

    std::vector<stats_metric> session_stats_metrics ();

This free function returns the list of available metrics exposed by libtorrent's statistics API. Each metric has a name and a value index. The value index is the index into the array in session_stats_alert where this metric's value can be found when the session stats is sampled (by calling post_session_stats()).

[report issue]

# find_metric_idx()

Declared in "libtorrent/session_stats.hpp"

    int find_metric_idx (string_view name);

given a name of a metric, this function returns the counter index of it, or -1 if it could not be found. The counter index is the index into the values array returned by session_stats_alert.

[report issue]

# enum metric_type_t

Declared in "libtorrent/session_stats.hpp"

name | value | description
--- | --- | ---
counter | 0 |
gauge | 1 |