Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Stopwatch timer and example Analysis of STOPWATCH

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report