免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
【Unity3D之獲取某個(gè)方法執(zhí)行的時(shí)間】
    #region 計(jì)算代碼執(zhí)行花費(fèi)的時(shí)間
    //如果要用納秒級(jí)或微秒級(jí)的話 就多測(cè)幾次取平均

    #region 納秒級(jí)10-9秒
    public static void calculate_cudetime_namiao(this MonoBehaviour mono, string methodname)
    {
        Type t = mono.GetType();

        MethodInfo vMethodInfo = t.GetMethod(methodname);
        if (vMethodInfo == null) return;

        PerformanceTimer timer = new PerformanceTimer();
        timer.Start();
        vMethodInfo.Invoke(mono, null);
        timer.Stop();

        MyDebug.Log(methodname + " 使用時(shí)間納秒  " + timer.Duration * 1000000000);
    }

    public static void calculate_cudetime_namiao(this MonoBehaviour mono, string methodname, object pram1)
    {
        Type t = mono.GetType();

        MethodInfo vMethodInfo = t.GetMethod(methodname, new Type[] { pram1.GetType() });
        if (vMethodInfo == null) return;

        PerformanceTimer timer = new PerformanceTimer();
        timer.Start();
        vMethodInfo.Invoke(mono, new object[] { pram1 });
        timer.Stop();

        MyDebug.Log(methodname + " 使用時(shí)間納秒  " + timer.Duration * 1000000000);
    }

    public static void calculate_cudetime_namiao(this MonoBehaviour mono, string methodname, object pram1, object pram2)
    {
        Type t = mono.GetType();
        Type p1 = pram1.GetType();
        Type p2 = pram2.GetType();
        MethodInfo vMethodInfo = t.GetMethod(methodname, new Type[] { pram1.GetType(), pram2.GetType() });
        if (vMethodInfo == null) return;
        PerformanceTimer timer = new PerformanceTimer();
        timer.Start();
        vMethodInfo.Invoke(mono, new object[] { pram1, pram2 });
        timer.Stop();

        MyDebug.Log(methodname + " 使用時(shí)間納秒  " + timer.Duration * 1000000000);
    }

    #endregion  納秒級(jí)10-9秒


    #region 微秒級(jí)10-6秒
    public static void calculate_cudetime_weimiao(this MonoBehaviour mono, string methodname)
    {
        Type t = mono.GetType();

        MethodInfo vMethodInfo = t.GetMethod(methodname);
        if (vMethodInfo == null) return;

        PerformanceTimer timer = new PerformanceTimer();
        timer.Start();
        vMethodInfo.Invoke(mono, null);
        timer.Stop();

        MyDebug.Log(methodname + " 使用時(shí)間微秒  " + timer.Duration * 1000000);
    }

    public static void calculate_cudetime_weimiao(this MonoBehaviour mono, string methodname, object pram1)
    {
        Type t = mono.GetType();

        MethodInfo vMethodInfo = t.GetMethod(methodname, new Type[] { pram1.GetType() });
        if (vMethodInfo == null) return;

        PerformanceTimer timer = new PerformanceTimer();
        timer.Start();
        vMethodInfo.Invoke(mono, new object[] { pram1 });
        timer.Stop();

        MyDebug.Log(methodname + " 使用時(shí)間微秒  " + timer.Duration * 1000000);
    }

    public static void calculate_cudetime_weimiao(this MonoBehaviour mono, string methodname, object pram1, object pram2)
    {
        Type t = mono.GetType();
        Type p1 = pram1.GetType();
        Type p2 = pram2.GetType();
        MethodInfo vMethodInfo = t.GetMethod(methodname, new Type[] { pram1.GetType(), pram2.GetType() });
        if (vMethodInfo == null) return;
        PerformanceTimer timer = new PerformanceTimer();
        timer.Start();
        vMethodInfo.Invoke(mono, new object[] { pram1, pram2 });
        timer.Stop();

        MyDebug.Log(methodname + " 使用時(shí)間微秒  " + timer.Duration * 1000000);
    }

    #endregion 微秒級(jí)10-6秒

    #region 毫秒級(jí)10-3秒

    public static void calculate_cudetime(this MonoBehaviour mono, string methodname)
    {
        Type t = mono.GetType();

        MethodInfo vMethodInfo = t.GetMethod(methodname);
        if (vMethodInfo == null) return;
        Stopwatch stopWatch = new Stopwatch();
        stopWatch.Start();
        vMethodInfo.Invoke(mono, null);
        stopWatch.Stop();

        MyDebug.Log(methodname + "   " + stopWatch.ElapsedMilliseconds);
    }

    public static void calculate_cudetime(this MonoBehaviour mono, string methodname, object pram1)
    {
        Type t = mono.GetType();

        MethodInfo vMethodInfo = t.GetMethod(methodname, new Type[] { pram1.GetType() });
        if (vMethodInfo == null) return;
        Stopwatch stopWatch = new Stopwatch();
        stopWatch.Start();
        vMethodInfo.Invoke(mono, new object[] { pram1 });
        stopWatch.Stop();

        MyDebug.Log(methodname + "  " + stopWatch.ElapsedMilliseconds);
    }

    public static void calculate_cudetime(this MonoBehaviour mono, string methodname, object pram1, object pram2)
    {
        Type t = mono.GetType();
        Type p1 = pram1.GetType();
        Type p2 = pram2.GetType();
        MethodInfo vMethodInfo = t.GetMethod(methodname, new Type[] { pram1.GetType(), pram2.GetType() });
        if (vMethodInfo == null) return;
        Stopwatch stopWatch = new Stopwatch();
        stopWatch.Start();
        vMethodInfo.Invoke(mono, new object[] { pram1, pram2 });
        stopWatch.Stop();

        MyDebug.Log(methodname + "   " + stopWatch.ElapsedMilliseconds);
    }

    /*
     調(diào)用事例  必須是公有方法
     *
     public void fun(int a)
     * {
       }
     * update()
     * {
       if (Input.GetKeyDown(KeyCode.Space))
        {
         //   calculate("Call");

       this.calculate_cudetime("fun",10)
        }
     * }

     */

    #endregion 毫秒級(jí)10-3秒

    #endregion 計(jì)算代碼執(zhí)行花費(fèi)的時(shí)間
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
C# TIMER定時(shí)激活某個(gè)時(shí)間/ StopWatch來(lái)計(jì)算模塊計(jì)算時(shí)間-程序開(kāi)發(fā)-紅黑聯(lián)...
8種主要排序算法的C#實(shí)現(xiàn)
8種主要排序算法的C#實(shí)現(xiàn) (二)
MonoTouch 的限制
C#程序員經(jīng)常用到的10個(gè)實(shí)用代碼片段
C#代碼精簡(jiǎn)優(yōu)化技巧(上)
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服