mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 22:22:00 +00:00
15 lines
418 B
C++
15 lines
418 B
C++
#include <sys/resource.h>
|
|
#include "Stopwatch.h"
|
|
|
|
StopwatchRUsage::Timestamp StopwatchRUsage::Timestamp::current()
|
|
{
|
|
StopwatchRUsage::Timestamp res;
|
|
|
|
::rusage rusage;
|
|
::getrusage(RUSAGE_THREAD, &rusage);
|
|
|
|
res.user_ns = rusage.ru_utime.tv_sec * 1000000000UL + rusage.ru_utime.tv_usec * 1000UL;
|
|
res.sys_ns = rusage.ru_stime.tv_sec * 1000000000UL + rusage.ru_stime.tv_usec * 1000UL;
|
|
return res;
|
|
}
|