调试技巧

tech2024-03-29  21

1:创建测试文件:vi text.c 2:测试文件代码:

#include<stdio.h> int main(int argc, char **argv) //传入要运行次数的值 { int temp=atoi(argv[1]); //要运行的次数 int i; for(i=0;i<time;i++){ system("./demo3"); } }

3.给要测试文件命名demo3gcc demo3.c -lpthread -o demo34.运行测试文件:

CLC@Embed_Learn:~/LINUX/xiancheng$ ./a.out 10 >>text.ret.txt & [4] 47026

注意(>> 是追加 生成一个text.ret 文本用来存放测试结果。 加个& 是后台运行的意识) 把运行的测试进程杀掉:kill -9 47163 然后打开text.ret.txt 就可以看到运行内容了。

最新回复(0)