• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "reporter.h"
17 #include "fault/communication_fault_impl.h"
18 #include "fault/database_fault_impl.h"
19 #include "fault/runtime_fault_impl.h"
20 #include "fault/service_fault_impl.h"
21 
22 #include "statistic/traffic_statistic_impl.h"
23 #include "statistic/visit_statistic_impl.h"
24 #include "statistic/database_statistic_impl.h"
25 #include "statistic/api_performance_statistic_impl.h"
26 
27 #include "behaviour/behaviour_reporter_impl.h"
28 
29 namespace OHOS {
30 namespace DistributedDataDfx {
GetInstance()31 Reporter* Reporter::GetInstance()
32 {
33     static Reporter reporter;
34     return &reporter;
35 }
36 
CommunicationFault()37 FaultReporter* Reporter::CommunicationFault()
38 {
39     static CommunicationFaultImpl communicationFault;
40     return &communicationFault;
41 }
42 
DatabaseFault()43 FaultReporter* Reporter::DatabaseFault()
44 {
45     static DatabaseFaultImpl databaseFault;
46     return &databaseFault;
47 }
48 
RuntimeFault()49 FaultReporter* Reporter::RuntimeFault()
50 {
51     static RuntimeFaultImpl runtimeFault;
52     return &runtimeFault;
53 }
54 
ServiceFault()55 FaultReporter* Reporter::ServiceFault()
56 {
57     static ServiceFaultImpl serviceFault;
58     return &serviceFault;
59 }
60 
TrafficStatistic()61 StatisticReporter<TrafficStat>* Reporter::TrafficStatistic()
62 {
63     static TrafficStatisticImpl trafficStatistic;
64     return &trafficStatistic;
65 }
66 
VisitStatistic()67 StatisticReporter<struct VisitStat>* Reporter::VisitStatistic()
68 {
69     static VisitStatisticImpl visitStatistic;
70     return &visitStatistic;
71 }
72 
DatabaseStatistic()73 StatisticReporter<struct DbStat>* Reporter::DatabaseStatistic()
74 {
75     static DatabaseStatisticImpl databaseStatistic;
76     return &databaseStatistic;
77 }
78 
ApiPerformanceStatistic()79 StatisticReporter<ApiPerformanceStat>* Reporter::ApiPerformanceStatistic()
80 {
81     static ApiPerformanceStatisticImpl apiPerformanceStat;
82     return &apiPerformanceStat;
83 }
84 
BehaviourReporter()85 BehaviourReporter* Reporter::BehaviourReporter()
86 {
87     static BehaviourReporterImpl behaviourReporterImpl;
88     return &behaviourReporterImpl;
89 }
90 } // namespace DistributedDataDfx
91 } // namespace OHOS
92