1 /* 2 * Copyright (c) 2025 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 HIVIEWDFX_HIVIEW_TRACE_COMMAND_STATE_H 16 #define HIVIEWDFX_HIVIEW_TRACE_COMMAND_STATE_H 17 #include <memory> 18 19 #include "trace_common.h" 20 #include "trace_base_state.h" 21 22 namespace OHOS::HiviewDFX { 23 class CommandState : public TraceBaseState { 24 public: 25 TraceRet OpenTrace(TraceScenario scenario, const std::vector<std::string> &tagGroups) override; 26 TraceRet OpenTrace(TraceScenario scenario, const std::string &args) override; 27 TraceRet DumpTrace(TraceScenario scenario, uint32_t maxDuration, uint64_t happenTime, TraceRetInfo &info) override; 28 TraceRet TraceDropOn(TraceScenario scenario) override; 29 TraceRet CloseTrace(TraceScenario scenario) override; 30 31 protected: GetTag()32 std::string GetTag() override 33 { 34 return "CommandState"; 35 } 36 }; 37 38 class CommandDropState : public TraceBaseState { 39 public: 40 TraceRet OpenTrace(TraceScenario scenario, const std::vector<std::string> &tagGroups) override; 41 TraceRet OpenTrace(TraceScenario scenario, const std::string &args) override; 42 TraceRet TraceDropOff(TraceScenario scenario, TraceRetInfo &info) override; 43 TraceRet CloseTrace(TraceScenario scenario) override; 44 45 protected: GetTag()46 std::string GetTag() override 47 { 48 return "CommandDropState"; 49 } 50 }; 51 } 52 #endif //HIVIEWDFX_HIVIEW_TRACE_COMMAND_STATE_H 53