2015-07-10 98 views
-2

所以我在linux下使用raspberry pi做了一个质量保证任务,这7个程序是preload,preload.c,run_test,run_test.c,runit_mainain,runit_preload,runit_test。在linux中测量执行时间

我所做的是运行runit_preload,然后运行run_test,然后拔掉树莓并在最后运行runit_maintain。我需要记录每个程序的执行时间,但每次尝试时间-p runit_preload或time -p ./preload.c时,都不会显示时间,而是再次运行程序。

+0

阅读[时间(7)](http://man7.org/linux/man-pages/man7/time.7.html) –

回答

1

如果您已经在C中使用过时间API(在C中搜索gettime函数),它会更容易,更准确。在主函数的开始和结束处获得时间值并运行程序。重复此过程多次以获得最差的运行时间。