mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-21 01:00:48 +00:00
Merge pull request #15737 from azat/profile-events-fixes
Fix RealTimeMicroseconds ProfileEvents
This commit is contained in:
commit
342f3b07dc
@ -82,13 +82,6 @@ inline UInt64 getCurrentTimeNanoseconds(clockid_t clock_type = CLOCK_MONOTONIC)
|
||||
return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
|
||||
}
|
||||
|
||||
inline UInt64 getCurrentTimeMicroseconds()
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
return (tv.tv_sec) * 1000000U + (tv.tv_usec);
|
||||
}
|
||||
|
||||
struct RUsageCounters
|
||||
{
|
||||
/// In nanoseconds
|
||||
@ -115,13 +108,6 @@ struct RUsageCounters
|
||||
hard_page_faults = static_cast<UInt64>(rusage.ru_majflt);
|
||||
}
|
||||
|
||||
static RUsageCounters zeros(UInt64 real_time_ = getCurrentTimeNanoseconds())
|
||||
{
|
||||
RUsageCounters res;
|
||||
res.real_time = real_time_;
|
||||
return res;
|
||||
}
|
||||
|
||||
static RUsageCounters current(UInt64 real_time_ = getCurrentTimeNanoseconds())
|
||||
{
|
||||
::rusage rusage {};
|
||||
|
@ -171,7 +171,8 @@ void ThreadStatus::initPerformanceCounters()
|
||||
query_start_time_microseconds = time_in_microseconds(now);
|
||||
++queries_started;
|
||||
|
||||
*last_rusage = RUsageCounters::current(query_start_time_nanoseconds);
|
||||
// query_start_time_nanoseconds cannot be used here since RUsageCounters expect CLOCK_MONOTONIC
|
||||
*last_rusage = RUsageCounters::current();
|
||||
|
||||
if (query_context)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user