1#include <Common/ProfileEvents.h>
2#include <DataTypes/DataTypeString.h>
3#include <DataTypes/DataTypesNumber.h>
4#include <Storages/System/StorageSystemEvents.h>
5
6namespace DB
7{
8
9NamesAndTypesList StorageSystemEvents::getNamesAndTypes()
10{
11 return {
12 {"event", std::make_shared<DataTypeString>()},
13 {"value", std::make_shared<DataTypeUInt64>()},
14 {"description", std::make_shared<DataTypeString>()},
15 };
16}
17
18void StorageSystemEvents::fillData(MutableColumns & res_columns, const Context &, const SelectQueryInfo &) const
19{
20 for (size_t i = 0, end = ProfileEvents::end(); i < end; ++i)
21 {
22 UInt64 value = ProfileEvents::global_counters[i];
23
24 if (0 != value)
25 {
26 res_columns[0]->insert(ProfileEvents::getName(ProfileEvents::Event(i)));
27 res_columns[1]->insert(value);
28 res_columns[2]->insert(ProfileEvents::getDocumentation(ProfileEvents::Event(i)));
29 }
30 }
31}
32
33}
34