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 * Description: BytraceOps implements 16 */ 17 #include "bytrace_ops.h" 18 19 #include "logging.h" 20 #include "string_utils.h" 21 22 FTRACE_NS_BEGIN BytraceOps()23BytraceOps::BytraceOps() : TraceOps("/system/bin/bytrace", "bytrace", BYTRACE) {} 24 ~BytraceOps()25BytraceOps::~BytraceOps() {} 26 PrepareListCategoriesCmd()27bool BytraceOps::PrepareListCategoriesCmd() 28 { 29 args_.push_back("-l"); 30 return true; 31 } 32 PrepareEnableCategoriesCmd()33bool BytraceOps::PrepareEnableCategoriesCmd() 34 { 35 args_.push_back("--trace_begin"); 36 args_.push_back("-t"); 37 args_.push_back("1"); 38 39 for (auto& category : targetCategories_) { 40 args_.push_back(category); 41 } 42 return true; 43 } 44 PrepareDisableCategoriesCmd()45bool BytraceOps::PrepareDisableCategoriesCmd() 46 { 47 args_.push_back("--trace_finish"); 48 return true; 49 } 50 FTRACE_NS_END