【轉】分析器視窗 Profiler window

來源:互聯網
上載者:User

標籤:des   android   style   http   os   使用   io   strong   ar   

轉自unity聖典:

http://game.ceeger.com/Manual/ProfilerWindow.html

http://game.ceeger.com/Manual/Profiler.html

 分析器視窗 Profiler windowDate:2013-07-01 13:44 

Attaching to Unity players 附加到Unity播放器

To profile your game running on an other device or a player running on another computer, it is possible to connect the editor to that other player. The dropdown Active Profiler will show all players running on the local network. These players are identified by player type and the host name running the player "iPhonePlayer (Toms iPhone)". To be able to connect to a player, the player must be launched with the Development Build checkbox found in the Build Settings dialog. From here it is also possible to tick a checkbox to make the Editor and Player Autoconnect at startup.

要 分析你的遊戲運行在其他裝置上或者在另一台電腦上啟動並執行播放器,可以串連編輯器到其他播放器。Active Profiler下拉式功能表顯示在本網上啟動並執行所有播放器。這些播放器通過播放器的類型和運行播放器的主機名稱"iPhonePlayer(Toms iPhone)"被識別。要能夠串連到一個播放器,播放器必須在 Build Settings對話方塊中找到Development Build 複選框勾上的情況下打包產生。從這裡也可以勾選一個複選框,使編輯器和播放器在啟動時自動連接。

Profiler Controls 分析器控制項

Profiler controls are in the toolbar at the top of the window. Use these to turn profiling on and off, navigate through profiled frames and so on. The transport controls are at the far right end of the toolbar. Note that when the game is running and the profiler is collecting data clicking on any of these transport controls will pause the game. The controls go to the first recorded frame, step one frame back, step one frame forward and go to the last frame respectively. The profiler does not keep all recorded frames, so the notion of the first frame should really be though of as the oldest frame that is still kept in memory. The "current" transport button causes the profile statistics window to display data collected in real-time. The Active Profiler popup menu allows you to select whether profiling should be done in the editor or a separate player (for example, a game running on an attached iOS device).

分析器控制項在視窗頂部的工具列。使用這些控制項開啟 和關閉分析,瀏覽分析好的幀等。傳輸控制項在工具列的最右端。請注意,當遊戲運行、分析器收集資料時,點擊任何這些傳輸控制項(那兩個小箭頭)將暫停遊戲。控 件轉到記錄的第一幀,一步一幀向前(左箭頭)??,一步一幀向後(右箭頭),分別去到最後一幀。分析器不保留所有記錄的幀,因此第一幀的概念,事實上應該 是仍然儲存在記憶體中的最舊的一幀。 "current"按鈕會使得分析統計視窗顯示即時採集的資料。啟用分析器(Active Profiler)快顯功能表讓你選擇是否應在編輯器或一個或獨立播放器進行分析(例如,一個遊戲運行在iOS裝置)。

Deep Profiling 深度分析

When you turn on Deep Profile, all your script code is profiled - that is, all function calls are recorded. This is useful to know where exactly time is spent in your game code.

當你開啟深度分析(Deep Profile),所有指令碼代碼將被分析 - 也就是說,所有的函數調用被記錄。知道確切在你的遊戲代碼中花費的時間,這是有用的。

Note that Deep Profiling incurs a very large overhead and uses a lot of memory, and as a result your game will run significantly slower while profiling. If you are using complex script code, Deep Profiling might not be possible at all. Deep profiling should work fast enough for small games with simple scripting. If you find that Deep Profiling for your entire game causes the frame rate to drop so much that the game barely runs, you should consider not using this approach, and instead use the approach described below. You may find deep profiling more helpful as you are designing your game and deciding how to best implement key features. Note that for large games deep profiling may cause Unity to run out of memory and so for this reason deep profiling may not be possible.

注意深度分析 (Deep Profiling)會造成非常大的開銷,並使用大量的記憶體,結果你的遊戲在分析同時運行明顯變慢。如果您使用的是複雜的指令碼代碼,深度分析可能不會完全 有效。深度分析為使用簡單的指令碼的小遊戲工作足夠快。如果您發現您的整個遊戲在深度分析時運行,導致畫面播放速率下降很多,以至於遊戲幾乎不能運行,你應該考慮 不採用這種方法,而是使用下面描述的方法。您可能會發現深度分析更有利於設計你的遊戲,並確定如何最好地實現關鍵特性。注意深度分析,對於大型遊戲可能會 導致Unity耗盡記憶體,基於這個原因,深度分析未必有效。

Manually profiling blocks of your script code will have a smaller overhead than using Deep Profiling. Use Profiler.BeginSample and Profiler.EndSample scripting functions to enable and disable profiling around sections of code.

手動分析指令碼代碼塊比使用深度分析產生更小的開銷。使用Profiler.BeginSample和Profiler.EndSample函數,啟用和禁用分析程式碼片段(從Profiler.BeginSample 到Profiler.EndSample間的代碼)。

View SyncTime 查看同步時間

When running at a fixed framerate or running in sync with the vertical blank, Unity records the waiting time in "Wait For Target FPS". By default this amount of time is not shown in the profiler. To view how much time is spent waiting, you can toggle "View SyncTime". This is also a measure of how much headroom you have before losing frames.

當運行在一個固定的幀率或帶垂直空白同步運行,Unity在"Wait For Target FPS"記錄等待時間,預設情況下,該段時間沒有顯示在分析器。要查看等待花費多少時間,您可以切換"View SyncTime"。這也是衡量多少餘量你之前丟失幀。

Profiler Timeline 分析器時間軸

The upper part of the Profiler window displays performance data over time. When you run a game, data is recorded each frame, and the history of the last several hundred frames is displayed. Clicking on a particular frame will display it‘s details in the lower part of the window. Different details are displayed depending on which timeline area is currently selected.

分析器視窗的上部顯示隨著時間的推移的效能資料。當您運行遊戲,每一幀資料被記錄,最後則會顯示幾百幀的曆史。點擊一個特定的幀上,該幀的細節將顯示在視窗的下部。具體取決於當前選定的時間軸地區顯示不同的細節。

The vertical scale of the timeline is managed automatically and will attempt to fill the vertical space of the window. Note that to get more detail in say the CPU Usage area you can remove the Memory and Rendering areas. Also, the splitter between the timeline and the statistics area can be selected and dragged downward to increase the screen area used for the timeline chart.

時間軸的垂直刻度是自 動管理,並嘗試填補視窗的垂直空間。請注意,要獲得更多關於CPU的使用率(CPU Usage)的細節,您可以刪除記憶體(Memory )和渲染(Rendering )地區。此外,時間軸和統計地區之間的分離器能被選擇和向下拖動,為時間軸圖表增加螢幕面積。

The timeline consists of several areas: CPU Usage, Rendering and Memory. These areas can be removed by clicking the close button in the panel, and re-added again using the Add Area drop down in the Profile Controls bar.

時間軸包括幾個方面:CPU使用率,渲染和記憶體。這些地區可以在面板上按一下關閉按鈕刪除和 在分析控制項(Profile Controls)工具列中使用Add Area 下拉式功能表再次重新添加。

  • CPU Usage Area CPU使用率地區
  • Rendering Area 渲染地區
  • Memory Area 記憶體地區
  • Audio Area 音頻地區
  • Physics Area 物理學地區
  • GPU Area GPU地區

     

    分析器(僅專業版) Profiler (Pro only)Date:2013-07-01 14:17 

    The Unity Profiler helps you to optimize your game. It reports for you how much time is spent in the various areas of your game. For example, it can report the percentage of time spent rendering, animating or in your game logic.

    Unity分析器可以協助你最佳化你的遊戲。它為您報告在你的遊戲的各個領域所花費的時間。例如,它可以報告渲染、動畫或在你的遊戲邏輯花費時間的百分比。

    You can play your game in the Editor with Profiling on, and it will record performance data. The Profiler window then displays the data in a timeline, so you can see the frames or areas that spike (take more time) than others. By clicking anywhere in the timeline, the bottom section of the Profiler window will display detailed information for the selected frame.

    在編輯器中,你可以將你的遊戲在分析器運行著的狀態下運行,它會記錄效能資料。 分析器視窗,在時間軸上顯示資料,所以你可以看到幀或地區峰值(比其他需要更多的時間)。在時間軸中的任何地方按一下,分析器視窗的底部地區會顯示選定的幀的詳細資料。

    Note that profiling has to instrument your code. This instrumentation has a small impact on the performance of your game. Typically this overhead is small enough to not affect the game framerate. When using profiling it is typical to consider only the ratio (or percentage) of time spent in certain areas. Also, to improve performance focus on those parts of the game that consume the most time. Compare profiling results before and after code changes and determine the improvements you measure. Sometimes changes you make to improve performance might have a negative effect on frame rate; unexpected consequences of code optimization should be expected.

    請注意,分析時必須檢測你的代碼。這檢 測會對你的遊戲效能有小小影響。通常情況下,這種開銷是足夠小,不會影響遊戲的幀率。當流量分析時,它是典型的考慮時間花費在某些領域的比例(或百分 比)。此外,為了提高效能,重點在遊戲消耗的時間最多的那些部分。代碼更改前後比較分析結果,並確定您測量的改進。有時,您所做的更改來提高效能,可能對 畫面播放速率有負面影響;應預計代碼最佳化的意外的後果。

    • Profiler window 分析器視窗
      • CPU Usage Area CPU使用率地區
      • Rendering Area 渲染地區
      • Memory Area 記憶體地區
      • Audio Area 音頻地區
      • ProfilerPhysics 物理學地區
      • GPU Area GPU地區
    See Also 參見
    • Optimizing Graphics Performance page.
      最佳化圖形效能頁面
    iOS

    Remote profiling can be enabled on iOS devices by following these steps:

    iOS裝置上啟用遠程分析可以通過以下步驟:

    1. Connect your iOS device to your WiFi network (local/adhoc WiFi network is used by profiler to send profiling data from device to the Unity Editor).
      您的iOS裝置串連到WiFi網路(分析器使用本地/adhoc WiFi網路發送分析資料,從裝置到Unity的編輯器)。
    2. Check "Autoconnect Profiler" checkbox in Unity‘s build settings dialog.
      在Unity的構建設定(build settings)對話方塊中的,勾上複選框"自動連接分析器(Autoconnect Profiler)"。
    3. Attach your device to your Mac via cable and hit "Build & Run" in Unity Editor.
      通過資料線將您的裝置串連到你的Mac,在Unity編輯器中點擊"Build &Run"。
    4. When app launches on device open profiler window in Unity Editor (Window->Profiler)
      當應用程式在裝置上啟動,在Unity的編輯器開啟分析器視窗(Window->Profiler)

    If you are using a firewall, you need to make sure that ports 54998 to 55511 are open in the firewall‘s outbound rules - these are the ports used by Unity for remote profiling.

    如果使用了防火牆,你必須確保連接埠54998 到 55511在防火牆的出站規則被開啟。這些連接埠都是Unity遠程分析要使用的連接埠。

    Note: Sometimes Unity Editor might not autoconnect to the device. In such cases profiler connection might be initiated from Profiler Window Active Profiler drop down menu by select appropriate device.

    註:有時,在Unity的編輯器可能不會自動連接到該裝置。在這種情況下,在分析器視窗的Active Profiler下拉式功能表選擇相應的裝置,分析器串連可以主動發起。

    Android

    Remote profiling can be enabled on Android devices through two different paths : WiFi or ADB.

    遠程分析可以在Android裝置通過兩種不同的途徑啟用:WiFi或ADB。

    For WiFi profiling, follow these steps:

    對於WiFi分析,用下列的這些步驟:

    1. Make sure to disable Mobile Data on your Android device.
      確保在Andriod裝置禁用行動數據。
    2. Connect your Android device to your WiFi network.
      串連Android裝置到你的Wifi網路。
    3. Check the "Autoconnect Profiler" checkbox in Unity‘s build settings dialog.
      在Unity編譯設定對話方塊,檢查Autoconnect Profiler複選框是否勾選。
    4. Attach your device to your Mac/PC via cable and hit "Build & Run" in Unity Editor.
      通過資料線串連你的裝置到電腦,在Unity點擊Build & Run。
    5. When the app launches on the device, open the profiler window in Unity Editor (Window->Profiler)
      當應用程式在裝置上啟動,在Unity開啟分析器視窗(Window->Profiler)。
    6. If the Unity Editor fails to autoconnect to the device, select the appropriate device from the Profiler Window Active Profiler drop down menu.
      如果Unity無法自動連接到該裝置,從分析器視窗Active Profiler下拉式功能表,選擇相應的裝置。

    Note: The Android device and host computer (running the Unity Editor) must both be on the same subnet for the device detection to work.

    注意:Android裝置和主機電腦(正運行Unity)必須兩者在同一子網,才能正常運行裝置檢測工作。

    For ADB profiling, follow these steps:

    對於ADB分析,用下列的這些步驟:

    • Attach your device to your Mac/PC via cable and make sure ADB recognizes the device (i.e. it shows in adb devices list).
      通過資料線串連裝置到電腦,並確保ADB裝置裝置(也就是說它顯示在ADB裝置列表)。
    • Open a Terminal window / CMD prompt and enter
      開啟一個終端視窗/ CMD提示符並輸入
    adb forward tcp:54999 localabstract:Unity-<insert bundle identifier here>
    • Check the "Development Build" checkbox in Unity‘s build settings dialog, and hit "Build & Run".
      在Unity編譯設定對話方塊,檢查Development Build複選框是否勾選,並點擊Build & Run。
    • When the app launches on the device, open the profiler window in Unity Editor (Window->Profiler)
      當應用程式在裝置上啟動,在Unity開啟分析器視窗(Window->Profiler)。
    • Select the AndroidProfiler([email protected]:54999) from the Profiler Window Active Profiler drop down menu.
      從分析器視窗Active Profiler下拉式功能表選擇AndroidProfiler([email protected]:54999)

    Note: The entry in the drop down menu is only visible when the selected target is Android.

    注意:進入下拉式功能表,當選擇目標是Android唯一可見時選擇。

    If you are using a firewall, you need to make sure that ports 54998 to 55511 are open in the firewall‘s outbound rules - these are the ports used by Unity for remote profiling.

    如果使用了防火牆,你必須確保連接埠54998 到 55511在防火牆的出站規則被開啟。這些連接埠都是Unity遠程分析要使用的連接埠。

【轉】分析器視窗 Profiler window

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.