如何知道我的程序的执行时间? [英] how to know the duration of execution of my program?
本文介绍了如何知道我的程序的执行时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我现在已经完成了我的程序(Web服务器),我想知道从客户端收到的请求执行的持续时间,
持续时间=发送(响应)的时间-接收(请求)的时间
非常感谢您的朋友
i have now finished my program (web server) and i want to know the duration of execution of the request recieved from client,,,
duration = time of sent(response) - time of received (request)
thank you so much friends
推荐答案
看看System.Diagnostics中的StopWatch
类
例如
http://www.dijksterhuis.org/timing-function-performance-stopwatch-class/ [ ^ ]
Have a look at theStopWatch
class in System.Diagnostics
e.g.
http://www.dijksterhuis.org/timing-function-performance-stopwatch-class/[^]
如果您使用的是Firefox,则可以使用 FireBug [
If you are using Firefox, you can use FireBug[^] to accomplish this task. IE has also something similar to this.
尝试这个想法:
try this idea:
DateTime x= new DateTime.Now();
将此放入每个请求&回应
然后例如:
put this in each of request & response
then for example:
Label1.Text = x.ToString();
如果您找到此帮助,请完整投票:)
if you find this help full plz vote up :)
这篇关于如何知道我的程序的执行时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文