148f512ceSopenharmony_ci/* 248f512ceSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 348f512ceSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 448f512ceSopenharmony_ci * you may not use this file except in compliance with the License. 548f512ceSopenharmony_ci * You may obtain a copy of the License at 648f512ceSopenharmony_ci * 748f512ceSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 848f512ceSopenharmony_ci * 948f512ceSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1048f512ceSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1148f512ceSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1248f512ceSopenharmony_ci * See the License for the specific language governing permissions and 1348f512ceSopenharmony_ci * limitations under the License. 1448f512ceSopenharmony_ci */ 1548f512ceSopenharmony_ci#ifndef SUBCOMMAND_LIST_H_ 1648f512ceSopenharmony_ci#define SUBCOMMAND_LIST_H_ 1748f512ceSopenharmony_ci 1848f512ceSopenharmony_ci#include <algorithm> 1948f512ceSopenharmony_ci#include <memory> 2048f512ceSopenharmony_ci#include <string> 2148f512ceSopenharmony_ci#include <vector> 2248f512ceSopenharmony_ci 2348f512ceSopenharmony_ci#include "debug_logger.h" 2448f512ceSopenharmony_ci#include "option.h" 2548f512ceSopenharmony_ci#include "perf_events.h" 2648f512ceSopenharmony_ci#include "subcommand.h" 2748f512ceSopenharmony_ci#include "utilities.h" 2848f512ceSopenharmony_ci 2948f512ceSopenharmony_cinamespace OHOS { 3048f512ceSopenharmony_cinamespace Developtools { 3148f512ceSopenharmony_cinamespace HiPerf { 3248f512ceSopenharmony_ciclass SubCommandList : public SubCommand { 3348f512ceSopenharmony_cipublic: 3448f512ceSopenharmony_ci SubCommandList() 3548f512ceSopenharmony_ci // clang-format off 3648f512ceSopenharmony_ci : SubCommand("list", "List the supported event types.", 3748f512ceSopenharmony_ci "Usage: hiperf list [event type name]\n" 3848f512ceSopenharmony_ci " List all supported event types on this devices.\n" 3948f512ceSopenharmony_ci " To list the events of a specific type, specify the type name\n" 4048f512ceSopenharmony_ci " hw hardware events\n" 4148f512ceSopenharmony_ci " sw software events\n" 4248f512ceSopenharmony_ci " tp tracepoint events\n" 4348f512ceSopenharmony_ci " cache hardware cache events\n" 4448f512ceSopenharmony_ci " raw raw pmu events\n\n" 4548f512ceSopenharmony_ci ) 4648f512ceSopenharmony_ci // clang-format on 4748f512ceSopenharmony_ci { 4848f512ceSopenharmony_ci } 4948f512ceSopenharmony_ci 5048f512ceSopenharmony_ci bool OnSubCommand(std::vector<std::string> &args) override; 5148f512ceSopenharmony_ci 5248f512ceSopenharmony_ci static void RegisterSubCommandList(void); 5348f512ceSopenharmony_ci 5448f512ceSopenharmony_ciprivate: 5548f512ceSopenharmony_ci PerfEvents perfEvents_; 5648f512ceSopenharmony_ci 5748f512ceSopenharmony_ci const std::map<std::string, perf_type_id> SUPPORT_NAME_OPTIONS = { 5848f512ceSopenharmony_ci {"hw", PERF_TYPE_HARDWARE}, {"sw", PERF_TYPE_SOFTWARE}, {"tp", PERF_TYPE_TRACEPOINT}, 5948f512ceSopenharmony_ci {"cache", PERF_TYPE_HW_CACHE}, {"raw", PERF_TYPE_RAW}, 6048f512ceSopenharmony_ci }; 6148f512ceSopenharmony_ci 6248f512ceSopenharmony_ci bool ShowSupportEventsTypes(std::vector<perf_type_id> requestEventTypes); 6348f512ceSopenharmony_ci void SetHM(); 6448f512ceSopenharmony_ci}; 6548f512ceSopenharmony_ci} // namespace HiPerf 6648f512ceSopenharmony_ci} // namespace Developtools 6748f512ceSopenharmony_ci} // namespace OHOS 6848f512ceSopenharmony_ci#endif // SUBCOMMAND_LIST_H_ 69