更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
perf_stat.h 文件参考

浏览源代码.

函数

void PerfStat (int fd, int argc, char **argv)
 

函数说明

◆ PerfStat()

void PerfStat ( int  fd,
int  argc,
char **  argv 
)

在文件 perf_stat.c107 行定义.

108{
109 int ret;
110 int child;
111 SubCmd cmd = {0};
112
113 if (argc < 3) { /* perf stat argc is at least 3 */
114 return;
115 }
116
117 ret = PerfStatAttrInit();
118 if (ret != 0) {
119 printf("perf stat attr init failed\n");
120 return;
121 }
122
123 ret = ParseOptions(argc - 2, &argv[2], g_statOpts, &cmd); /* parse option and cmd begin at index 2 */
124 if (ret != 0) {
125 printf("parse error\n");
126 return;
127 }
128
129 ret = PerfConfig(fd, &g_statAttr);
130 if (ret != 0) {
131 printf("perf config failed\n");
132 return;
133 }
134
135 PerfStart(fd, 0);
136 child = fork();
137 if (child < 0) {
138 printf("fork error\n");
139 goto EXIT;
140 } else if (child == 0) {
141 (void)execve(cmd.path, cmd.params, NULL);
142 exit(0);
143 }
144
145 (void)waitpid(child, 0, 0);
146EXIT:
147 PerfStop(fd);
148}
void PerfStart(int fd, size_t sectionId)
Definition: perf.c:106
int PerfConfig(int fd, PerfConfigAttr *attr)
Definition: perf.c:116
void PerfStop(int fd)
Definition: perf.c:111
int ParseOptions(int argc, char **argv, PerfOption *opt, SubCmd *cmd)
Definition: option.c:71
static int PerfStatAttrInit(void)
Definition: perf_stat.c:65
static PerfConfigAttr g_statAttr
Definition: perf_stat.c:39
static PerfOption g_statOpts[]
Definition: perf_stat.c:56
void exit(int status)
Definition: stdlib.c:60
Definition: option.h:61
const char * path
Definition: option.h:62
char * params[CMD_MAX_PARAMS]
Definition: option.h:63
ARG_NUM_3 ARG_NUM_1 ARG_NUM_2 ARG_NUM_2 ARG_NUM_3 ARG_NUM_1 ARG_NUM_4 ARG_NUM_2 ARG_NUM_2 ARG_NUM_5 ARG_NUM_2 void
函数调用图:
这是这个函数的调用关系图: