用C语言测量程序执行时间时出现问题 [英] Problem in measuring program execution time in c language

查看:315
本文介绍了用C语言测量程序执行时间时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何测量TC下任何C程序的实际执行时间?
用合适的例子解释我.....

How to measure the ACTUAL execution time of any C program under TC?
explain me with suitable example.....

推荐答案

当您说执行时间"时,是指程序在系统上运行的时间长度,或程序使用多少CPU时间?

如果您想要总的运行时间,只需获取应用程序启动和结束时的系统日期,然后减去它们即可得出玩具的持续时间.

如果要CPU使用率...

[ ^ ]
When you say "execution time", do you mean the length of time the program is running on the system, or how much CPU time the program uses?

If you want total running time, just get the system date when the app starts and when it ends, and subtract them to get the toytal duration.

If you want CPU utilization...

almost 29 million google results for the search phrase "c determine cpu usage for an application" [^]


这篇关于用C语言测量程序执行时间时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆