2018-05-31 15:54:08 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Interpreters/SystemLog.h>
|
|
|
|
|
|
|
|
|
2018-06-14 13:03:23 +00:00
|
|
|
namespace ProfileEvents
|
|
|
|
{
|
|
|
|
class Counters;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-31 15:54:08 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
struct QueryThreadLogElement
|
|
|
|
{
|
|
|
|
time_t event_time{};
|
|
|
|
/// When query was attached to current thread
|
|
|
|
time_t query_start_time{};
|
|
|
|
/// Real time spent by the thread to execute the query
|
|
|
|
UInt64 query_duration_ms{};
|
|
|
|
|
|
|
|
/// The data fetched from DB in current thread to execute the query
|
|
|
|
UInt64 read_rows{};
|
|
|
|
UInt64 read_bytes{};
|
|
|
|
|
|
|
|
/// The data written to DB
|
|
|
|
UInt64 written_rows{};
|
|
|
|
UInt64 written_bytes{};
|
|
|
|
|
2018-06-09 15:29:08 +00:00
|
|
|
Int64 memory_usage{};
|
2018-06-20 15:21:42 +00:00
|
|
|
Int64 peak_memory_usage{};
|
2018-05-31 15:54:08 +00:00
|
|
|
|
2018-06-01 11:58:17 +00:00
|
|
|
String thread_name;
|
2018-05-31 15:54:08 +00:00
|
|
|
UInt32 thread_number{};
|
|
|
|
Int32 os_thread_id{};
|
|
|
|
UInt32 master_thread_number{};
|
|
|
|
Int32 master_os_thread_id{};
|
|
|
|
|
|
|
|
String query;
|
|
|
|
ClientInfo client_info;
|
|
|
|
|
|
|
|
std::shared_ptr<ProfileEvents::Counters> profile_counters;
|
|
|
|
|
|
|
|
static std::string name() { return "QueryThreadLog"; }
|
|
|
|
|
|
|
|
static Block createBlock();
|
|
|
|
void appendToBlock(Block & block) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class QueryThreadLog : public SystemLog<QueryThreadLogElement>
|
|
|
|
{
|
|
|
|
using SystemLog<QueryThreadLogElement>::SystemLog;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|