1 /* 2 * Copyright (c) 2021-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 HIVIEW_PLATFORM_MANAGEMENT_INFO_EXPORT_SERVICE_H 16 #define HIVIEW_PLATFORM_MANAGEMENT_INFO_EXPORT_SERVICE_H 17 18 #include <cstdint> 19 #include <memory> 20 #include <string> 21 #include <vector> 22 23 #include "audit_log_parser.h" 24 25 namespace OHOS { 26 namespace HiviewDFX { 27 class HiviewService { 28 public: HiviewService()29 HiviewService() : parser_(nullptr){}; ~HiviewService()30 ~HiviewService(){}; 31 void StartService(); 32 // Dump interface 33 void DumpRequestDispatcher(int fd, const std::vector<std::string>& cmds); 34 35 int32_t Copy(const std::string& srcFilePath, const std::string& destFilePath); 36 int32_t Move(const std::string& srcFilePath, const std::string& destFilePath); 37 int32_t Remove(const std::string& filePath); 38 private: 39 void DumpDetailedInfo(int fd); 40 void DumpPluginInfo(int fd, const std::vector<std::string>& cmds) const; 41 void DumpLoadedPluginInfo(int fd) const; 42 void DumpPluginUsageInfo(int fd); 43 void DumpPluginUsageInfo(int fd, const std::string& pluginName) const; 44 45 void DumpThreadUsageInfo(int fd) const; 46 void DumpThreadUsageInfo(int fd, const std::string& threadName) const; 47 48 void DumpPipelineUsageInfo(int fd) const; 49 void DumpPipelineUsageInfo(int fd, const std::string& pipelineName) const; 50 51 int CopyFile(const std::string& srcFilePath, const std::string& destFilePath); 52 53 void PrintUsage(int fd) const; 54 std::unique_ptr<AuditLogParser> parser_; 55 }; 56 } // namespace HiviewDFX 57 } // namespace OHOS 58 #endif // HIVIEW_PLATFORM_MANAGEMENT_INFO_EXPORT_SERVICE_H 59