21
21
#include " butil/fd_utility.h" // make_close_on_exec
22
22
#include " butil/logging.h" // LOG
23
23
#include " butil/third_party/murmurhash3/murmurhash3.h" // fmix32
24
+ #include " bvar/latency_recorder.h" // bvar::LatencyRecorder
24
25
#include " bthread/bthread.h" // bthread_start_background
25
26
#include " brpc/event_dispatcher.h"
26
- #include " brpc/reloadable_flags.h"
27
27
28
28
DECLARE_int32 (task_group_ntags);
29
29
@@ -37,6 +37,8 @@ DEFINE_bool(usercode_in_coroutine, false,
37
37
" User's callback are run in coroutine, no bthread or pthread blocking call" );
38
38
39
39
static EventDispatcher* g_edisp = NULL ;
40
+ static bvar::LatencyRecorder* g_edisp_read_lantency = NULL ;
41
+ static bvar::LatencyRecorder* g_edisp_write_lantency = NULL ;
40
42
static pthread_once_t g_edisp_once = PTHREAD_ONCE_INIT;
41
43
42
44
static void StopAndJoinGlobalDispatchers () {
@@ -46,8 +48,13 @@ static void StopAndJoinGlobalDispatchers() {
46
48
g_edisp[i * FLAGS_event_dispatcher_num + j].Join ();
47
49
}
48
50
}
51
+ delete g_edisp_read_lantency;
52
+ delete g_edisp_write_lantency;
49
53
}
50
54
void InitializeGlobalDispatchers () {
55
+ g_edisp_read_lantency = new bvar::LatencyRecorder (" event_dispatcher_read_latency" );
56
+ g_edisp_write_lantency = new bvar::LatencyRecorder (" event_dispatcher_write_latency" );
57
+
51
58
g_edisp = new EventDispatcher[FLAGS_task_group_ntags * FLAGS_event_dispatcher_num];
52
59
for (int i = 0 ; i < FLAGS_task_group_ntags; ++i) {
53
60
for (int j = 0 ; j < FLAGS_event_dispatcher_num; ++j) {
0 commit comments