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_COLLECT_PARAMETER_H 16 #define UNIFIED_COLLECTION_COLLECT_PARAMETER_H 17 #include <vector> 18 #include <string> 19 #include <map> 20 21 namespace OHOS { 22 namespace HiviewDFX { 23 class CollectParameter { 24 friend class XcollectService; 25 public: 26 explicit CollectParameter(const std::string &caller); 27 ~CollectParameter(); 28 29 public: 30 void SetRuntime(const std::string &second = "*", const std::string &minute = "*", const std::string &hour = "*"); 31 void SetExecTimes(uint32_t times = 1); 32 void SetCollectItems(const std::vector<std::string> &items); 33 void SetConfig(const std::string &collectModule, const std::string &config, const std::string value); 34 void SetConfig(const std::string &collectModule, const std::string &config, uint32_t value); 35 36 private: 37 const std::string caller_; 38 uint32_t times_; 39 std::string second_; 40 std::string minute_; 41 std::string hour_; 42 std::vector<std::string> items_; 43 std::map<std::string, std::map<std::string, uint32_t>> itemIntConfigs_; 44 std::map<std::string, std::map<std::string, std::string>> itemStrConfigs_; 45 }; 46 } // namespace HiviewDFX 47 } // namespace OHOS 48 #endif // UNIFIED_COLLECTION_COLLECT_PARAMETER_H 49