Skip to content

Commit

Permalink
添加测试程序
Browse files Browse the repository at this point in the history
  • Loading branch information
vvzxy committed Jul 19, 2024
1 parent 66cf7f4 commit e17cc2a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions eBPF_Supermarket/CPU_Subsystem/cpu_watcher/test/test_cpuwatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ static struct env {
bool mq_delay_test;
bool preempt_test;
bool schedule_test;
bool mutrace_test;
} env = {
.sar_test = false,
.cs_delay_test = false,
.sc_delay_test = false,
.mq_delay_test = false,
.preempt_test = false,
.schedule_test = false,
.mutrace_test = false,
};

const char argp_program_doc[] ="To test cpu_watcher.\n";
Expand All @@ -37,6 +39,7 @@ static const struct argp_option opts[] = {
{ "mq_delay", 'm', NULL, 0, "To test mq_delay", 0 },
{ "preempt_delay", 'p', NULL, 0, "To test preempt_delay", 0 },
{ "schedule_delay", 'd', NULL, 0, "To test schedule_delay", 0 },
{ "mu_trace", 'x', NULL, 0, "To test mutrace", 0 },
{ "all", 'a', NULL, 0, "To test all", 0 },
{ NULL, 'h', NULL, OPTION_HIDDEN, "show the full help", 0 },
{},
Expand Down Expand Up @@ -71,6 +74,9 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
break;
case 'd':
env.schedule_test = true;
break;
case 'x':
env.mutrace_test = true;
break;
case 'h':
argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
Expand Down Expand Up @@ -191,5 +197,17 @@ int main(int argc, char **argv){
printf("\n");
}

if(env.mutrace_test){
printf("MUTRACE_TEST----------------------------------------------\n");
//MUTRACE功能测试逻辑:系统上执行混合压力测试,包括4个顺序读写硬盘线程、4个IO操作线程,持续15秒,观察加压前后的变化。
char *argvv[] = { "/usr/bin/stress-ng", "--hdd", "4", "--hdd-opts", "wr-seq,rd-seq", "--io", "4", "--timeout", "15s", "--metrics-brief", NULL };
char *envp[] = { "PATH=/bin", NULL };
printf("MUTRACE功能测试逻辑:系统上执行混合压力测试,包括4个顺序读写硬盘线程、4个IO操作线程和4个UDP网络操作线程,持续15秒,观察加压前后的变化\n");
printf("执行指令 stress-ng --hdd 4 --hdd-opts wr-seq,rd-seq --io 4 --udp 4 --timeout 15s --metrics-brief\n");
execve("/usr/bin/stress-ng", argvv, envp);
perror("execve");
printf("\n");
}

return 0;
}

0 comments on commit e17cc2a

Please sign in to comment.