大家好,我有个问题。如何获得程序执行时间? [英] Hello every one I have a question for you guys. How to get the time execution of program?

查看:73
本文介绍了大家好,我有个问题。如何获得程序执行时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是C#的初学者,

我有一个使用C#的汇总程序,我想知道如何从汇总编程中获得时间处理。



我尝试了什么:



我是初学者用C#编程而且我尝试过任何事情,但我很困惑。

I am beginner in C#,
I have a sum program using C# and I want to know how to get time processing from sum programing.

What I have tried:

I am beginner in programing in C# and I have tried anything but I am very confused.

推荐答案

您的意思是:性能测试:使用System.Diagnostics.Stopwatch进行精确的运行时间测量 [ ^ ]?


使用秒表类(System.Diagnostics) [ ^ ]



use Stopwatch Class (System.Diagnostics)[^]

System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
watch.Start();
// Your code for exection
.
.
watch.Stop();
var milliSeconds = watch.Elapsed.TotalMilliseconds;
var seconds = watch.Elapsed.TotalSeconds;


这篇关于大家好,我有个问题。如何获得程序执行时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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