zoukankan      html  css  js  c++  java
  • 测试stopwatch频率

    测试stopwatch频率

     1 using UnityEngine;
     2 using System.Collections;
     3 using System.Diagnostics;
     4 
     5 public class teststopwatch : MonoBehaviour {
     6 
     7 Stopwatch watch = new Stopwatch();
     8 
     9 // Use this for initialization
    10 void Start() {
    11 
    12 }
    13 
    14 void OnGUI() {
    15 watch.Start();
    16 for (int i = 0; i < 10000; ++i) {
    17 int j = i * i * 3 / 4;
    18 }
    19 watch.Stop();
    20 float sec = watch.ElapsedMilliseconds / 1000.0f;
    21 GUIStyle myGUIStyle = new GUIStyle();
    22 myGUIStyle.fontSize = 50;
    23 GUI.Label(new Rect(Screen.height / 3, 200, 200, 200), "Frequency:" + Stopwatch.Frequency.ToString(), myGUIStyle);
    24 
    25 }
    26 
    27 // Update is called once per frame
    28 void Update () {
    29 
    30 }
    31 }

    最终结构都是 10000000

    本文由博主(YinaPan)原创或者转载,如若转载请务必注明出处,谢谢合作!
  • 相关阅读:
    两数之和
    dict用法
    xgboost
    常见报错
    四、ABP 学习系列
    Apache Htpasswd生成和验证密码
    ABP 学习系列
    Gradle 配置
    ArcGis教程
    在线排程设置生成器Quartz
  • 原文地址:https://www.cnblogs.com/YinaPan/p/stopwatchf.html
Copyright © 2011-2022 走看看