/* * Copyright (c) 2019 TAOS Data, Inc. * * This program is free software: you can use, redistribute, and/or modify * it under the terms of the GNU Affero General Public License, version 3 * or later ("AGPL"), as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ #ifndef _TD_TRACE_H_ #define _TD_TRACE_H_ #include #ifdef __cplusplus extern "C" { #endif #pragma(push, 1) typedef struct STraceId { int64_t rootId; int64_t msgId; } STraceId; #pragma(pop) #define TRACE_SET_ROOTID(traceId, root) \ do { \ (traceId)->rootId = root; \ } while (0); #define TRACE_GET_ROOTID(traceId) (traceId)->rootId #define TRACE_SET_MSGID(traceId, mId) \ do { \ (traceId)->msgId = mId; \ } while (0) #define TRACE_GET_MSGID(traceId) (traceId)->msgId #define TRACE_TO_STR(traceId, buf) \ do { \ sprintf(buf, "0x%" PRIx64 ":0x%" PRIx64 "", traceId->rootId, traceId->msgId); \ } while (0) #ifdef __cplusplus } #endif #endif