跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • 对于 U3D Stopwatch ElapsedTick 的疑惑
未分類
12 6 月 2020

对于 U3D Stopwatch ElapsedTick 的疑惑

对于 U3D Stopwatch ElapsedTick 的疑惑

資深大佬 : bakatori 8

记录方法

    static public void time (string key) {         if (timeKeyHub.ContainsKey (key)) {             Debug.LogError ("MLOG.cs time key already exist");         } else {             System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch ();             timeKeyHub.Add (key, sw);             sw.Start ();         }     }     static public void timeEnd (string key) {         if (timeKeyHub.ContainsKey (key)) {             System.Diagnostics.Stopwatch sw;             timeKeyHub.TryGetValue (key, out sw);             sw.Stop();             Debug.Log (string.Format ("<color=blue>{0}</color> {1} ms {2} ticks", key, sw.ElapsedMilliseconds, sw.ElapsedTicks));             // BIRDTODO:用池子             sw = null;             timeKeyHub.Remove (key);         } else {             Debug.LogError ("MLOG.cs timeend key not exist");         }     } 

A*算法的部分代码

    MLOG.time("newCostDealer");     MLOG.time("newCostDealer - newCost");     float newCost = cost_so_far[cur]+ heuristic(next.Pos, end.Pos);     MLOG.timeEnd("newCostDealer - newCost");      MLOG.time("newCostDealer - 0");     bool tmp2 = !cost_so_far.ContainsKey(next);     MLOG.timeEnd("newCostDealer - 0");      MLOG.time("newCostDealer - temp3");     bool tmp3 = false;     if (!tmp2) {         tmp3 = newCost < cost_so_far[next];     }     MLOG.timeEnd("newCostDealer - temp3");      if (tmp2 || tmp3)     {         MLOG.time("newCostDealer - 1");         frontier.put(next, newCost);         MLOG.timeEnd("newCostDealer - 1");          MLOG.time("newCostDealer - 2");         cost_so_far[next] = newCost;         // MLOG.info("came_from[next] = cur," + next.ToString() + " " + cur.ToString());         came_from[next] = cur;         MLOG.timeEnd("newCostDealer - 2");     }      MLOG.timeEnd("newCostDealer"); 

运行结果:

对于 U3D Stopwatch ElapsedTick 的疑惑

求教,为啥 newCostDealer ticks 和其它记录加起来差那么多丫?!

大佬有話說 (1)

  • 主 資深大佬 : bakatori

    求教

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具