mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 17:02:25 +00:00
b7ef5a699c
* Get rid of non-existent vectorclass * Move FastMemcpy to contribs * Restore comments * Disable FastMemcpy on non-Linux * Fix cmake file * Don't build FastMemcpy for ARM64 * Replace FastMemcpy submodule with its contents * Fix cmake file * Move widechar_width to contrib/ * Move sumbur to contrib/ * Move consistent-hashing to contrib/ * Fix UBSan tests
40 lines
886 B
C++
40 lines
886 B
C++
#include "ExtendedLogChannel.h"
|
|
|
|
#include <sys/time.h>
|
|
#include <Common/CurrentThread.h>
|
|
#include <Common/Exception.h>
|
|
#include <common/getThreadId.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
namespace ErrorCodes
|
|
{
|
|
extern const int CANNOT_GETTIMEOFDAY;
|
|
}
|
|
|
|
ExtendedLogMessage ExtendedLogMessage::getFrom(const Poco::Message & base)
|
|
{
|
|
ExtendedLogMessage msg_ext(base);
|
|
|
|
::timeval tv;
|
|
if (0 != gettimeofday(&tv, nullptr))
|
|
DB::throwFromErrno("Cannot gettimeofday", ErrorCodes::CANNOT_GETTIMEOFDAY);
|
|
|
|
msg_ext.time_seconds = static_cast<UInt32>(tv.tv_sec);
|
|
msg_ext.time_microseconds = static_cast<UInt32>(tv.tv_usec);
|
|
|
|
if (current_thread)
|
|
{
|
|
auto query_id_ref = CurrentThread::getQueryId();
|
|
if (query_id_ref.size)
|
|
msg_ext.query_id.assign(query_id_ref.data, query_id_ref.size);
|
|
}
|
|
|
|
msg_ext.thread_id = getThreadId();
|
|
|
|
return msg_ext;
|
|
}
|
|
|
|
}
|