aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/IO/AsyncReadCounters.h
blob: 1f84b2a214bdfa4a4f6a0f2b1a61d13d92179268 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once
#include <Core/Types.h>
#include <Columns/ColumnMap.h>

namespace DB
{

/// Metrics for asynchronous reading feature.
struct AsyncReadCounters
{
    /// Count current and max number of tasks in a asynchronous read pool.
    /// The tasks are requests to read the data.
    size_t max_parallel_read_tasks = 0;
    size_t current_parallel_read_tasks = 0;

    /// Count current and max number of tasks in a reader prefetch read pool.
    /// The tasks are calls to IMergeTreeReader::prefetch(), which does not do
    /// any reading but creates a request for read. But as we need to wait for
    /// marks to be loaded during this prefetch, we do it in a threadpool too.
    size_t max_parallel_prefetch_tasks = 0;
    size_t current_parallel_prefetch_tasks = 0;
    size_t total_prefetch_tasks = 0;

    mutable std::mutex mutex;

    AsyncReadCounters() = default;

    void dumpToMapColumn(IColumn * column) const;
};
using AsyncReadCountersPtr = std::shared_ptr<AsyncReadCounters>;

}