C# method to test code execution time

大家讲道理
Release: 2016-11-11 14:48:32
Original
1367 people have browsed it

Stopwatch sw = new Stopwatch();  
sw.Start();  
//这里填写要执行的代码  
sw.Stop();  
Console.WriteLine("总运行时间:" + sw.Elapsed);  
Console.WriteLine("测量实例得出的总运行时间(毫秒为单位):" + sw.ElapsedMilliseconds);  
Console.WriteLine("总运行时间(计时器刻度标识):" + sw.ElapsedTicks);  
Console.WriteLine("计时器是否运行:" + sw.IsRunning.ToString());
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template