• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef SMARTPERF_COMMAND_H
17 #define SMARTPERF_COMMAND_H
18 
19 #include <iostream>
20 #include <vector>
21 #include "common.h"
22 
23 namespace OHOS {
24 namespace SmartPerf {
25 class SmartPerfCommand {
26 public:
27     const std::string smartPerfExeName = "SP_daemon";
28     const std::string smartPerfVersion = "1.0.1\n";
29     const std::string smartPerfMsgErr = "error input!\n use command '--help' get more information\n";
30     const std::string smartPerfMsg = "usage: SP_daemon <options> <arguments> \n"
31         "--------------------------------------------------------------------\n"
32         "These are common commands list:\n"
33         " -N             set num of profiler <must be non-null>\n"
34         " -PKG           set pkgname of profiler \n"
35         " -PID           set process id of profiler \n"
36         " -OUT           set output path of CSV\n"
37         " -c             get cpuFreq and cpuLoad  \n"
38         " -g             get gpuFreq and gpuLoad  \n"
39         " -f             get fps and fps jitters \n"
40         " -t             get soc-temp gpu-temp .. \n"
41         " -p             get current_now and voltage_now \n"
42         " -r             get ram(pss) \n"
43         " -snapshot      get screen capture\n"
44         "--------------------------------------------------------------------\n"
45         "Example: SP_daemon -N 20 -PKG ohos.samples.ecg -c -g -t -p -f \n"
46         "--------------------------------------------------------------------\n";
47     const int oneParam = 1;
48     const int twoParam = 2;
49     const int threeParamMore = 3;
50     SmartPerfCommand(int argc, char *argv[]);
~SmartPerfCommand()51     ~SmartPerfCommand() {};
52     static void InitSomething();
53     std::string ExecCommand();
54     void HelpCommand(CommandHelp type) const;
55     void HandleCommand(std::string argStr, std::string argStr1);
56     // 采集次数
57     int num = 0;
58     // 包名
59     std::string pkgName = "";
60     // 是否开启trace 抓取
61     int trace = 0;
62     // csv输出路径
63     std::string outPath = "/data/local/tmp/data.csv";
64     std::string outPathParam = "";
65     // 指定进程pid
66     std::string pid = "";
67     // 采集配置项
68     std::vector<std::string> configs;
69 };
70 }
71 }
72 #endif // SMARTPERF_COMMAND_H