• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #ifndef INTERFACES_INNER_API_UNIFIED_COLLECTION_CLIENT_TRACE_COLLECTOR_H
16 #define INTERFACES_INNER_API_UNIFIED_COLLECTION_CLIENT_TRACE_COLLECTOR_H
17 #include <cinttypes>
18 #include <memory>
19 #include <string>
20 #include <vector>
21 
22 #include "collect_result.h"
23 
24 namespace OHOS {
25 namespace HiviewDFX {
26 namespace UCollectClient {
27 class TraceCollector {
28 public:
29     TraceCollector() = default;
30     virtual ~TraceCollector() = default;
31     enum Caller {
32         RELIABILITY,
33         XPERF,
34         XPOWER,
35         BETACLUB,
36         DEVELOP,
37         OTHER,
38     };
39 
40 public:
41     virtual CollectResult<int32_t> OpenSnapshot(const std::vector<std::string>& tagGroups) = 0;
42     virtual CollectResult<std::vector<std::string>> DumpSnapshot(Caller caller = Caller::OTHER) = 0;
43     virtual CollectResult<int32_t> OpenRecording(const std::string& tags) = 0;
44     virtual CollectResult<int32_t> RecordingOn() = 0;
45     virtual CollectResult<std::vector<std::string>> RecordingOff() = 0;
46     virtual CollectResult<int32_t> Close() = 0;
47     virtual CollectResult<int32_t> Recover() = 0;
48 
49     static std::shared_ptr<TraceCollector> Create();
50 }; // TraceCollector
51 } // UCollectClient
52 } // HiviewDFX
53 } // OHOS
54 #endif // INTERFACES_INNER_API_UNIFIED_COLLECTION_CLIENT_TRACE_COLLECTOR_H
55