Get the App
SLTechnology News&Howtos  ›  Development  › 

Stopwatch timer and example Analysis of STOPWATCH

Shulou Source: shulou.com Published: 2022-06-03 19:17:15 10月03日 Update

I would like to share with you the stopwatch timer and the example analysis of STOPWATCH. I believe most people don't know much about it, so share this article for your reference. I hope you will learn a lot after reading this article. Let's learn about it together.

Stopwatch: stopwatch timer, used to record the running time of a program, usually used to test the execution efficiency of code in terms of time. (need to quote: System.Diagnostics. )

Stopwatch sw=new Stopwatch (); / / instantiate an object.

Sw.Start (): starts the timer.

Sw.Stop (): turns off the timer.

Sw.Elapsed: [attribute] gets the length of time between the start and the end of the timer.

The following code can measure the running time of a section of executing code:

Using UnityEngine;using System.Diagnostics;public class Test: MonoBehaviour {void Start () {Stopwatch sw = new Stopwatch (); sw.Start (); /. / / N lines of execution code are omitted here. / /. Sw.Stop (); print (sw.Elapsed);}} these are all the contents of the article "stopwatch timer and sample Analysis of STOPWATCH". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Timer code stopwatch time article example analysis content run not much between most instance object property efficiency duration more knowledge program Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Tech Info MariaDB MySQL Linux