1 /* 2 * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. 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 #ifndef NATIVE_MEMORY_PROFILER_SA_CONFIG_H 17 #define NATIVE_MEMORY_PROFILER_SA_CONFIG_H 18 19 #include "parcel.h" 20 21 namespace OHOS::Developtools::NativeDaemon { 22 namespace { 23 constexpr uint32_t DEFAULT_DURATION = 20; 24 constexpr uint8_t DEFAULT_STACK_DAPTH = 30; 25 } 26 class NativeMemoryProfilerSaConfig : public Parcelable { 27 public: 28 bool Marshalling(Parcel& parcel) const override; 29 static bool Unmarshalling(Parcel& parcel, std::shared_ptr<NativeMemoryProfilerSaConfig> config); 30 static void PrintConfig(std::shared_ptr<NativeMemoryProfilerSaConfig>& config); 31 32 public: 33 int32_t pid_{0}; 34 std::string filePath_; 35 uint32_t duration_{DEFAULT_DURATION}; // second 36 int32_t filterSize_{0}; 37 uint32_t shareMemorySize_{0}; 38 std::string processName_; 39 uint8_t maxStackDepth_{DEFAULT_STACK_DAPTH}; 40 bool mallocDisable_{false}; 41 bool mmapDisable_{false}; 42 bool freeStackData_{false}; 43 bool munmapStackData_{false}; 44 uint32_t mallocFreeMatchingInterval_{0}; 45 uint32_t mallocFreeMatchingCnt_{0}; 46 bool stringCompressed_{true}; 47 bool fpUnwind_{true}; 48 bool blocked_{true}; 49 bool recordAccurately_{true}; 50 bool startupMode_{false}; 51 bool memtraceEnable_{false}; 52 bool offlineSymbolization_{true}; 53 bool callframeCompress_{true}; 54 uint32_t statisticsInterval_{0}; 55 clockid_t clockId_{CLOCK_REALTIME}; 56 uint32_t sampleInterval_{0}; 57 bool responseLibraryMode_{false}; 58 bool printNmd_{false}; 59 bool printNmdOnly_{false}; 60 bool hookstandalone_{false}; 61 bool saveFile_{false}; 62 std::string fileName_; 63 uint32_t nmdPid_{0}; 64 uint32_t nmdType_{0}; 65 int32_t jsStackReport_{0}; 66 uint8_t maxJsStackDepth_{0}; 67 std::string filterNapiName_; 68 std::string targetSoName_; 69 uint32_t largestSize_{0}; 70 uint32_t secondLargestSize_{0}; 71 uint32_t maxGrowthSize_{0}; 72 }; 73 } // namespace OHOS::Developtools::NativeDaemon 74 #endif // NATIVE_MEMORY_PROFILER_SA_CONFIG_H