ClickHouse/src/Interpreters/ProfileEventsExt.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
994 B
C++
Raw Normal View History

#pragma once
#include <Common/ProfileEvents.h>
2022-03-01 07:54:23 +00:00
#include <Common/ThreadStatus.h>
#include <DataTypes/DataTypeEnum.h>
#include <Columns/IColumn.h>
namespace ProfileEvents
{
2022-02-15 08:25:07 +00:00
constexpr size_t NAME_COLUMN_INDEX = 4;
constexpr size_t VALUE_COLUMN_INDEX = 5;
struct ProfileEventsSnapshot
{
UInt64 thread_id;
2022-02-15 12:26:53 +00:00
CountersIncrement counters;
2022-02-15 08:25:07 +00:00
Int64 memory_usage;
time_t current_time;
};
2022-02-15 12:26:53 +00:00
using ThreadIdToCountersSnapshot = std::unordered_map<UInt64, Counters::Snapshot>;
2022-02-15 08:25:07 +00:00
/// Dumps profile events to columns Map(String, UInt64)
void dumpToMapColumn(const Counters::Snapshot & counters, DB::IColumn * column, bool nonzero_only = true);
2022-03-01 07:54:23 +00:00
void getProfileEvents(
const String & server_display_name,
DB::InternalProfileEventsQueuePtr profile_queue,
DB::Block & block,
ThreadIdToCountersSnapshot & last_sent_snapshots);
2022-02-15 08:25:07 +00:00
/// This is for ProfileEvents packets.
enum Type : int8_t
{
INCREMENT = 1,
GAUGE = 2,
};
extern std::shared_ptr<DB::DataTypeEnum8> TypeEnum;
}