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 #ifndef HIDUMPER_SERVICES_DUMPER_OPTS_H 16 #define HIDUMPER_SERVICES_DUMPER_OPTS_H 17 #include <string> 18 #include <vector> 19 namespace OHOS { 20 namespace HiviewDFX { 21 struct DumperOpts { 22 bool isDumpCpuFreq_; 23 bool isDumpCpuUsage_; 24 int cpuUsagePid_; 25 bool isDumpLog_; 26 std::vector<std::string> logArgs_; 27 bool isDumpMem_; 28 int memPid_; 29 bool isDumpStorage_; 30 int storagePid_; 31 bool isDumpNet_; 32 int netPid_; 33 bool isDumpList_; 34 bool isDumpService_; 35 bool isDumpSystemAbility_; 36 std::vector<std::string> abilitieNames_; 37 std::vector<std::string> abilitieArgs_; 38 bool isDumpSystem_; 39 std::vector<std::string> systemArgs_; 40 bool isDumpProcesses_; 41 int processPid_; 42 bool isFaultLog_; 43 std::string path_; // for zip 44 bool isAppendix_; 45 bool isShowSmaps_; 46 bool isShowSmapsInfo_; 47 bool isDumpJsHeapMem_; 48 bool isDumpJsHeapMemGC_; 49 bool isDumpJsHeapLeakobj_; 50 int dumpJsHeapMemPid_; 51 int threadId_; 52 int ipcStatPid_; 53 bool isDumpAllIpc_; 54 bool isDumpIpc_; 55 bool isDumpIpcStartStat_; 56 bool isDumpIpcStopStat_; 57 bool isDumpIpcStat_; 58 bool dumpJsRawHeap_; 59 bool dumpMemPrune_; 60 bool isDumpCjHeapMem_; 61 bool isDumpCjHeapMemGC_; 62 int dumpCjHeapMemPid_; 63 int timeInterval_; 64 bool isReceivedSigInt_; 65 bool showAshmem_; 66 bool showDmaBuf_; 67 68 public: 69 DumperOpts(); 70 void Reset(); 71 DumperOpts& operator = (const DumperOpts& opts); 72 void AddSelectAll(); 73 bool IsSelectAny() const; 74 bool IsDumpZip() const; 75 bool CheckRemainingOptions(std::string& errStr) const; 76 bool CheckOptions(std::string& errStr) const; 77 }; 78 } // namespace HiviewDFX 79 } // namespace OHOS 80 #endif // HIDUMPER_SERVICES_DUMPER_OPTS_H 81