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 UNIFIED_COLLECTION_XCOLLECT_SERVICE_H 16 #define UNIFIED_COLLECTION_XCOLLECT_SERVICE_H 17 #include <string> 18 #include "collect_callback.h" 19 #include "collect_parameter.h" 20 #include "collect_item_result.h" 21 22 constexpr int FILE_RIGHT_READ = 00644; 23 24 namespace OHOS { 25 namespace HiviewDFX { 26 class XcollectService { 27 public: 28 XcollectService(std::shared_ptr<CollectParameter> collectParameter); 29 XcollectService(std::shared_ptr<CollectParameter> collectParameter, std::shared_ptr<CollectCallback> callback); 30 ~XcollectService(); 31 32 public: 33 void StartCollect(); 34 35 private: 36 void CollectHiTrace(const std::string &item); 37 static std::string DumpTraceToDir(); 38 39 private: 40 std::shared_ptr<CollectParameter> collectParameter_; 41 std::shared_ptr<CollectCallback> callback_; 42 }; 43 } // namespace HiviewDFX 44 } // namespace OHOS 45 #endif // UNIFIED_COLLECTION_XCOLLECT_SERVICE_H 46