25 {
26 if (latency_map_.find(GetProcLatencyKey(role_attr)) != latency_map_.end()) {
27 AERROR <<
"Failed to create proc latency var: "
28 "reader with the same channel already exists.";
29 return false;
30 }
31
32 if (latency_map_.find(GetTranLatencyKey(role_attr)) != latency_map_.end()) {
33 AERROR <<
"Failed to create tran latency var: "
34 "reader with the same channel already exists.";
35 return false;
36 }
37
38 if (latency_map_.find(GetCyberLatencyKey(role_attr)) != latency_map_.end()) {
39 AERROR <<
"Failed to create cyber latency var: "
40 "reader with the same channel already exists.";
41 return false;
42 }
43
44 latency_map_[GetProcLatencyKey(role_attr)] =
45 std::make_shared<::bvar::LatencyRecorder>(
46 role_attr.node_name() + "-"
47 + role_attr.channel_name(), "proc");
48 if (role_attr.channel_name() != TIMER_COMPONENT_CHAN_NAME) {
49 latency_map_[GetTranLatencyKey(role_attr)] =
50 std::make_shared<::bvar::LatencyRecorder>(
51 role_attr.node_name() + "-" +
52 role_attr.channel_name(), "tran");
53 latency_map_[GetCyberLatencyKey(role_attr)] =
54 std::make_shared<::bvar::LatencyRecorder>(
55 role_attr.node_name() + "-" +
56 role_attr.channel_name(), "cyber");
57 status_map_[GetStartProcessStatusKey(role_attr)] =
58 std::make_shared<::bvar::Status<uint64_t>>(
59 role_attr.node_name() + "-" +
60 role_attr.channel_name() + "-process", 0);
61 status_map_[GetTotalMsgsStatusKey(role_attr)] =
62 std::make_shared<::bvar::Status<uint64_t>>(
63 role_attr.node_name() + "-" +
64 role_attr.channel_name() + "-total-msgs-nums", 0);
65 adder_map_[GetTotalRecvStatusKey(role_attr)] =
66 std::make_shared<::bvar::Adder<int32_t>>(
67 role_attr.node_name() +
68 "-" + role_attr.channel_name() + "-recv-msgs-nums");
69 }
70 return true;
71}