mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-10-17 22:10:54 +00:00
A bit of reformatting code
This commit is contained in:
parent
30a87a8a58
commit
0cf949f1b5
@ -258,11 +258,6 @@ namespace DB
|
|||||||
current_thread_counters = nullptr;
|
current_thread_counters = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger * PerfDescriptorsHolder::getLogger()
|
|
||||||
{
|
|
||||||
return &Logger::get("PerfDescriptorsHolder");
|
|
||||||
}
|
|
||||||
|
|
||||||
PerfDescriptorsHolder::PerfDescriptorsHolder()
|
PerfDescriptorsHolder::PerfDescriptorsHolder()
|
||||||
{
|
{
|
||||||
for (int & descriptor : descriptors)
|
for (int & descriptor : descriptors)
|
||||||
@ -285,6 +280,12 @@ namespace DB
|
|||||||
descriptor = -1;
|
descriptor = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger * PerfDescriptorsHolder::getLogger()
|
||||||
|
{
|
||||||
|
return &Logger::get("PerfDescriptorsHolder");
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void PerfEventsCounters::initializeProfileEvents(PerfEventsCounters &) {}
|
void PerfEventsCounters::initializeProfileEvents(PerfEventsCounters &) {}
|
||||||
|
@ -153,8 +153,6 @@ struct PerfEventInfo
|
|||||||
ProfileEvents::Event profile_event;
|
ProfileEvents::Event profile_event;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct PerfDescriptorsHolder;
|
struct PerfDescriptorsHolder;
|
||||||
|
|
||||||
struct PerfEventsCounters
|
struct PerfEventsCounters
|
||||||
@ -172,17 +170,14 @@ struct PerfEventsCounters
|
|||||||
// that restricts perf_event_open() to processes with the CAP_SYS_ADMIN capability
|
// that restricts perf_event_open() to processes with the CAP_SYS_ADMIN capability
|
||||||
// todo: check whether perf_event_open() is available with CAP_SYS_ADMIN
|
// todo: check whether perf_event_open() is available with CAP_SYS_ADMIN
|
||||||
|
|
||||||
#if defined(__linux__)
|
|
||||||
static constexpr size_t NUMBER_OF_RAW_EVENTS = 18;
|
static constexpr size_t NUMBER_OF_RAW_EVENTS = 18;
|
||||||
|
|
||||||
static const PerfEventInfo raw_events_info[];
|
static const PerfEventInfo raw_events_info[];
|
||||||
#endif
|
|
||||||
|
|
||||||
static void initializeProfileEvents(PerfEventsCounters & counters);
|
static void initializeProfileEvents(PerfEventsCounters & counters);
|
||||||
|
|
||||||
static void finalizeProfileEvents(PerfEventsCounters & counters, ProfileEvents::Counters & profile_events);
|
static void finalizeProfileEvents(PerfEventsCounters & counters, ProfileEvents::Counters & profile_events);
|
||||||
|
|
||||||
#if defined(__linux__)
|
|
||||||
private:
|
private:
|
||||||
// used to write information about perf unavailability only once for all threads
|
// used to write information about perf unavailability only once for all threads
|
||||||
static std::atomic<bool> perf_unavailability_logged;
|
static std::atomic<bool> perf_unavailability_logged;
|
||||||
@ -201,21 +196,30 @@ private:
|
|||||||
static bool initializeThreadLocalEvents(PerfEventsCounters & counters);
|
static bool initializeThreadLocalEvents(PerfEventsCounters & counters);
|
||||||
|
|
||||||
[[nodiscard]] UInt64 getRawValue(int event_type, int event_config) const;
|
[[nodiscard]] UInt64 getRawValue(int event_type, int event_config) const;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(__linux__)
|
|
||||||
|
|
||||||
struct PerfDescriptorsHolder {
|
struct PerfDescriptorsHolder {
|
||||||
static Logger * getLogger();
|
|
||||||
|
|
||||||
int descriptors[PerfEventsCounters::NUMBER_OF_RAW_EVENTS]{};
|
int descriptors[PerfEventsCounters::NUMBER_OF_RAW_EVENTS]{};
|
||||||
|
|
||||||
PerfDescriptorsHolder();
|
PerfDescriptorsHolder();
|
||||||
|
|
||||||
~PerfDescriptorsHolder();
|
~PerfDescriptorsHolder();
|
||||||
|
|
||||||
|
static Logger * getLogger();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
struct PerfEventsCounters
|
||||||
|
{
|
||||||
|
static void initializeProfileEvents(PerfEventsCounters & counters);
|
||||||
|
static void finalizeProfileEvents(PerfEventsCounters & counters, ProfileEvents::Counters & profile_events);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
|
||||||
struct TasksStatsCounters
|
struct TasksStatsCounters
|
||||||
{
|
{
|
||||||
::taskstats stat;
|
::taskstats stat;
|
||||||
|
Loading…
Reference in New Issue
Block a user