File tree Expand file tree Collapse file tree 11 files changed +50
-8
lines changed
Expand file tree Collapse file tree 11 files changed +50
-8
lines changed Original file line number Diff line number Diff line change @@ -42,3 +42,6 @@ MODULES += jsonrpc
4242
4343# # 第三方库依赖
4444THIRDPARTY += nlohmann
45+
46+ # # 编译配置
47+ CCFLAGS += -DENABLE_TRACE_RECORDER=1
Original file line number Diff line number Diff line change @@ -45,7 +45,8 @@ set(TBOX_BASE_HEADERS
4545 catch_throw.h
4646 func_types.h
4747 object_pool.hpp
48- recorder.h)
48+ recorder.h
49+ wrapped_recorder.h)
4950
5051set (TBOX_BASE_SOURCES
5152 version .cpp
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ HEAD_FILES = \
4545 object_pool.hpp \
4646 func_types.h \
4747 recorder.h \
48+ wrapped_recorder.h \
4849
4950CPP_SRC_FILES = \
5051 version.cpp \
Original file line number Diff line number Diff line change 1+ /*
2+ * .============.
3+ * // M A K E / \
4+ * // C++ DEV / \
5+ * // E A S Y / \/ \
6+ * ++ ----------. \/\ .
7+ * \\ \ \ /\ /
8+ * \\ \ \ /
9+ * \\ \ \ /
10+ * -============'
11+ *
12+ * Copyright (c) 2024 Hevake and contributors, all rights reserved.
13+ *
14+ * This file is part of cpp-tbox (https://github.com/cpp-main/cpp-tbox)
15+ * Use of this source code is governed by MIT license that can be found
16+ * in the LICENSE file in the root of the source tree. All contributing
17+ * project authors may be found in the CONTRIBUTORS.md file in the root
18+ * of the source tree.
19+ */
20+ /**
21+ * 在 recorder.h 的基础上加 ENABLE_TRACE_RECORDER 宏开关
22+ * 使 recorder 功能可以在编译期间被关彻底关闭
23+ */
24+ #ifndef TBOX_TRACE_WRAPPED_RECORDER_H_20240610
25+ #define TBOX_TRACE_WRAPPED_RECORDER_H_20240610
26+
27+ #if ENABLE_TRACE_RECORDER
28+ #include "recorder.h"
29+ #else
30+ #define RECORD_SCOPE ()
31+ #define RECORD_DEFINE (name )
32+ #define RECORD_START (name )
33+ #define RECORD_STOP (name )
34+ #define RECORD_EVENT ()
35+ #endif
36+
37+ #endif //TBOX_TRACE_WRAPPED_RECORDER_H_20240610
Original file line number Diff line number Diff line change 2424#include < algorithm>
2525#include < tbox/base/log.h>
2626#include < tbox/base/assert.h>
27- #include < tbox/base/recorder .h>
27+ #include < tbox/base/wrapped_recorder .h>
2828
2929namespace tbox {
3030namespace event {
Original file line number Diff line number Diff line change 2222#include < algorithm>
2323#include < tbox/base/defines.h>
2424#include < tbox/base/assert.h>
25- #include < tbox/base/recorder .h>
25+ #include < tbox/base/wrapped_recorder .h>
2626
2727#include " timer_event_impl.h"
2828
Original file line number Diff line number Diff line change 2525#include < tbox/base/log.h>
2626#include < tbox/base/assert.h>
2727#include < tbox/base/defines.h>
28- #include < tbox/base/recorder .h>
28+ #include < tbox/base/wrapped_recorder .h>
2929
3030namespace tbox {
3131namespace event {
Original file line number Diff line number Diff line change 3232#include < tbox/base/log.h>
3333#include < tbox/base/defines.h>
3434#include < tbox/base/assert.h>
35- #include < tbox/base/recorder .h>
35+ #include < tbox/base/wrapped_recorder .h>
3636
3737namespace tbox {
3838namespace event {
Original file line number Diff line number Diff line change 2121#include " common_loop.h"
2222#include < tbox/base/log.h>
2323#include < tbox/base/assert.h>
24- #include < tbox/base/recorder .h>
24+ #include < tbox/base/wrapped_recorder .h>
2525
2626namespace tbox {
2727namespace event {
Original file line number Diff line number Diff line change 3535#include < tbox/base/assert.h>
3636#include < tbox/base/catch_throw.h>
3737#include < tbox/base/object_pool.hpp>
38- #include < tbox/base/recorder .h>
38+ #include < tbox/base/wrapped_recorder .h>
3939#include < tbox/event/loop.h>
4040
4141namespace tbox {
You can’t perform that action at this time.
0 commit comments