This article is a mirror article of machine translation, please click here to jump to the original article.

View: 23678|Reply: 2

[Source] .net/c# documents time-consuming methods for programs

[Copy link]
Posted on 3/9/2018 5:31:31 PM | | | |
Many times it takes time to output the program, and then record it,



Always record the current point in time at the beginning of program execution, record the end time point at the end, and then subtract the two times,

So is there any other way to be a little more decent?  Let me tell you, some ; )

The main body of this method is Stopwatch

His description is: For accurate measurement of running time, where is the applause of students who need to record time-consuming?

Specific use:

  System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();

  stopwatch. Start();

  Here: Time-consuming processes/methods that require calculations

  stopwatch. Stop();

  stopwatch. Elapsed.TotalSeconds // Here is the total number of running seconds of the output, down to milliseconds







Previous:DebuggerStepThrough feature saves debugging time
Next:Oracle+11G configuration PLSQL guide
Posted on 3/12/2018 12:24:06 PM |
Like one
 Landlord| Posted on 1/9/2025 3:56:38 PM |
ValueStopwatch is a lightweight timer in .NET for high-performance time measurement. As a value type, it avoids the overhead of packing and unpacking, and takes up less memory. It is easy to measure the execution time of code blocks through simple usage, and is more efficient than Stopwatch.

The code is as follows:

Source code address:The hyperlink login is visible.

Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com