Merge pull request #15737 from azat/profile-events-fixes

Fix RealTimeMicroseconds ProfileEvents
This commit is contained in:
alexey-milovidov 2020-10-08 13:14:15 +03:00 committed by GitHub
commit 342f3b07dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 15 deletions

View File

@ -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 {};

View File

@ -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)
{