UnityD性能消耗分析器_第1页
UnityD性能消耗分析器_第2页
UnityD性能消耗分析器_第3页
UnityD性能消耗分析器_第4页
UnityD性能消耗分析器_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、分析器(仅专业版)Profiler (Pro only)Date:2012-02-25 04:56The Unity P rofiler helps you to op timize your game. It rep orts for you how much time is spent in the various areas of your game. For exa mpl e, it can report the p ercentage of time spent rendering, animating or in your game logic.Unity分析器可以帮助你优化你的

2、游戏。它为您报告在你的游戏的各个领域所花费的时间。例如,它可以 报告渲染、动画或在你的游戏逻辑花费时间的百分比。You can play your game in the Editor with P rofiling on, and it will record p erformance data.The P rofiler window then dis pl ays the data in a timeline, so you can see the frames or areas that sp ike (take more time) than others. By clicking

3、anywhere in the timeline, the bottom section of the Profiler window will dis play detailed information for the selected frame.在编辑器中,你可以将你的游戏在分析器运行着的状态下运行,它会记录性能数据。分析器窗口,在时间轴上显示数据,所以你可以看到帧或区域峰值(比其他需要更多的时间)。在时间轴中的任何地方按一下,分析器窗口的底部区域会显示选定的帧的详细信息。Note that p rofiling has toinstrument your code. This inst

4、rumentation has a small i mpact on the p erformance of your game. Typi cally this overhead is small enough to not affect the game framerate. When using p rofiling it is typi cal to consider only the ratio (or p ercentage) of time sp ent in certain areas. Also, to imp rove p erformance focus on those

5、 p arts of the game that consume the most time. Compare p rofiling results before and after code changes anddetermine the imp rovementsyou measure. Sometimes changes you make to imp rove p erformance might have a negative effect on frame rate; unex pected consequences of code op timization should be

6、 exp ected.请注意,分析时必须检测你的代码。这检测会对你的游戏性能有小小影响。通常情况下,这种开销是足够小,不会影响游戏的帧率。当使用分析时,它是典型的考虑时间花费在某些领域的比例(或百分比)。此外,为了提高性能,重点在游戏消耗的时间最多的那些部分。代码更改前后比较分析结果,并确定您测量的改 进。有时,您所做的更改来提高性能,可能对帧速率有负面影响;应预计代码优化的意外的后果。怙 Pro-jlerAdd Profilerfe诂 Deep P = ofi:e LieM byncTinrie Active Profle;“FrmeiCPU Usage Pnrr - -carbdrre o

7、l亡*0一 PhyiiC5 Oth 1 J.lOms (LOOFPS)REndui门 q -D 17 Vai;5 ahg 心 2 VSIIMemory Tatjl Textdi hSemoiy M*shC?Gunt Miteiial CQunt Object CountAudio Playirg Sources Pjiutd Sources Aucjrc VQfSE 9*1 r I rl h rh Fri i*v*i rhiir iHuErai c hr*FunctionE. 一 TT3 勺,3k465. M6-1,斗G5斗5乙e MB136.14Total41.S MBCal IsMenV

8、C amera.Reride r- Camera .ImageEffects:、&loorriAndWoise.CinFenderImaQeC)He ightDepthOfField.OnRen deci mage 0 Di awing亍 Up d citeDerpthTex tureA CullingOverheadP hysics. SimulateMecliNoverTientMotor.OnCDllisionStayO 4nimdtion.U pctateMeshkinning.UpdateMeshSkiiinirtg.WaitForSkinThreads MeshSkiiininq.

9、 Pep areFollicle.UpdateAudiaManagei.UpdateGlowRlane.Upddte(jSendMouseEvents.DoSendMauseEventsf)ET cF戶 Ln n I 冲ri n n64Profiler windowAttach ing to Unity pl ayers附加到Unity播放器To p rofile your game running on an other device or a pl ayer running on another compu teris p ossible to connect the editor to

10、that other pl ayer.The drop downActive P rofilerall pl ayers running on the local network. These pl ayers are identified by pl ayer type and thehost name running the pl ayer i Phone PI ayer (Toms iP hone). To be able to connect to a pl ayer5%1%0二0.5%0 .2%4,3 和4.2%0.1%2.9%6.0%5.9%0.1%0.3%0.1%3.9%0 .2

11、%.3%1.5%0.8%C .4%,itwill show1631Build checkbox found in the Buildthe player must be launched with the DevelopmentSettings dialog. From here it is also po ssible to tick a checkbox to make the Editor and PI ayerAutoconnect at start up.要分析你的游戏运行在其他设备上或者在另一台计算机上运行的播放器,可以连接编辑器到其他播放器。Active Profiler下拉菜单

12、显示在本地网络上运行的所有播放器。这些播放器通过播放器的类型和运行播放Build器的主机名iP hone Pl ayer( Toms iP hone)被识别。要能够连接到一个播放器,播放器必须在Settings 对话框中找到Development Build复选框勾上的情况下打包生成。从这里也可以勾选一个复选框,使编辑器和播放器在启动时自动连接。P rofiler Con trols分析器控件Add ArBI 冷 Record j Deep Frafile ,Frame: 262 f 419An I I CurieritDeep Profili ng深度分析Active Profiler )弹

13、出菜单让你选择是否应 iOS设备)。P rofiler controls are in the toolbar at the top of the window. Use these to turn p rofiling on and off, navigate through p rofiled frames and so on. The trans port controls are at the far right end of the toolbar . Note that when the game is running and the p rofiler is collecting

14、 data clicking on any of these trans port controls will p ause the game. The controls go to the first recorded frame, ste p one frame back, ste p one frame forward and go to the last frame resp ectively.The profiler does not keep all recorded frames, so the notion of thefirst frame should really be

15、though of as the oldest frame that is still kept in memory. The current trans port button causes the p rofile statistics window to dis play data collected in real-time. The Active Profiler popup menu allows you to select whether p rofiling should be done in the editor or a sep arate pl ayer (for exa

16、 mple, a game running on an attached iOS device).分析器控件在窗口顶部的工具栏。使用这些控件打开和关闭分析,浏览分析好的帧等。传输控件在工具栏的最右端。请注意,当游戏运行、分析器收集数据时,点击任何这些传输控件(那两个小箭头)将暂停游戏。控件转到记录的第一帧,一步一帧向前(左箭头),一步一帧向后(右箭头),分别去到最后一帧。分析current器不保留所有记录的帧,因此第一帧的概念,事实上应该是仍然保存在内存中的最旧的一帧。按钮会使得分析统计窗口显示实时采集的数据。激活分析器(在编辑器或一个或独立播放器进行分析(例如,一个游戏运行在When you

17、 turn on Dee p P rofile,all your script code is profiled - that is, all function calls are recorded. This is useful to know where exactly time is sp ent in your game code.当你打开深度分析(Deep Profile),所有脚本代码将被分析-也就是说,所有的函数调用被记录。知道确切在你的游戏代码中花费的时间,这是有用的。very large overheadNote that Dee p P rofiling incurs a

18、and uses a lot of memory, and as aresult your game will run significantly slower while p rofiling. If you are using complex scri pt code, Deep P rofiling might not be p ossible at all. Deep p rofiling should work fast enough for small games with simple scri pting. If you find that Deep P rofiling fo

19、r your entire game causes the frame rate to drop so much that the game barely runs, you should consider not using this app roach, and instead use the app roach described below. You may find dee p p rofiling more helpful as you are designing your game and deciding how to best impi ement key features.

20、Note that for large games dee p p rofiling may cause Unity to run out of memory and so for this reason dee p p rofiling may not be p ossible.注意深度分析(Deep Profiling )会造成非常大的开销,并使用大量的内存,结果你的游戏在分析同时运 行明显变慢。如果您使用的是复杂的脚本代码,深度分析可能不会完全有效。深度分析为使用简单的脚本 的小游戏工作足够快。如果您发现您的整个游戏在深度分析时运行,导致帧速率下降很多,以至于游戏几乎不能运行,你应该考虑

21、不采用这种方法,而是使用下面描述的方法。您可能会发现深度分析更有利于设 计你的游戏,并确定如何最好地实现关键特性。注意深度分析,对于大型游戏可能会导致 Unity耗尽内存,基于这个原因,深度分析未必有效。Manually p rofiling blocks of your scri pt code will have a smaller overhead than using DeepProfiling. UseProfiler .BeginSampleand Profiler .EndSamplescripting functions to enable anddisable p rofil

22、ing around sections of code.手动分析脚本代码块比使用深度分析产生更小的开销。使用Profiler .BeginSample和Profiler .EndSample 函数,启用和禁用分析代码段(从 Profiler .BeginSample至U Profiler .EndSample间的代码)。View Syn cTime查看 SyncTimeWhen running at a fixed framerate or running in sync with the vertical blank, Unity recordsthe waiting time in Wai

23、t For Target FP S. 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 T arget FPS记录等待时间,默认情况下,该段时间没有显示在分析器。要

24、查看等待花费多少时间,您可以切换View SyncTime。这也是衡量多少余量你之前丢失帧。P rofiler Timeli ne分析器时间轴16m 5 tCOFP?)二 260. MR : r_6.5k JFTl.j MG:IEl&l.OkT113? at 一Memo rv-To-til AJlocated Texture Uerrnory i DtyecE CdjiIjanTOSUFFS.- CPU usjgeya 匚 ftjetrdering i_ Scrip,:一 口then沪.Rnderlngi- Draw Cl H Triangles VeniceThe upper part of

25、 the P rofiler window dis pl ays p erformance data over time. When you run a game, data is recorded each frame, and the history of the last several hundred frames is dis pl ayed. Clicking on a p articular frame will dis play its details in the lower part of the window.Different details are dis pl ay

26、ed dep ending on which timeline area is currently selected.分析器窗口的上部显示随着时间的推移的性能数据。当您运行游戏,每一帧数据被记录,最后则会显示几百帧的历史。点击一个特定的帧上,该帧的细节将显示在窗口的下部。具体取决于当前选定的时间轴区域显示不同的细节。The vertical scale of the timeline is managed automatically and will atte mpt to fill the vertical sp ace of the window. Note that to get mor

27、e detail in say the CPU Usage area you can remove the Memory and Rendering areas. Also, the spl itter between the timeline and the statistics area can be selected and dragged downward to increase the screen area used for the timeline chart.时间轴的垂直刻度是自动管理,并尝试填补窗口的垂直空间。请注意,要获得更多关于 CPU的使用率(CPUUsage)的细节,

28、您可以删除内存(Memory )和渲染(Rendering )区域。此外,时间轴和统计区域之 间的分离器能被选择和向下拖动,为时间轴图表增加屏幕面积。The timeline consists of several areas: CPU Usage, Rendering and Memory. These areas canAdd Area在分析be removed by clicking the close button in the p anel, and re-added again using thedrop down in the P rofile Controls bar.时间轴包

29、括几个方面:CPU使用率,渲染和内存。这些区域可以在面板上按一下关闭按钮删除和控件(Profile Controls)工具栏中使用 Add Area下拉菜单再次重新添加。CPU Usage Area(CPU使用率区域)口 RecordFrofiieFrame: 22 5 # 41.916ms lEOkKl7:0rflsI -H-J宜 liptsCArbuieCahectarFhvs i匚sO1 hersProfilerAdd AreaCPU U&agera1 HierarchyDC msFunctiorToUl5elfCalbMerwry TinT Canwrilender51药0怎輛20 B

30、5.7t- Drawing47.LK14.2K20 ES.iA Culllirig1.7KL”EK20 E0-1A tUIText RenderId掘0.7W20 BaiC ame r aJ mageLfFet tsO.OK0320 B0.0MeshSkifini ng11.iKLL刖10 B1卫Overhead6.73fi6”7KI0 E0l7FuelCellC fowLoe kAt. U p da 壇)6,4喘532E4 B0 7ObjectRocater.Update見右舛4右0 BO.e萨 CiUJ.Repaint3传?fi0.4丹12.1 KDm斗=.-Hr、,The CPU Usa

31、ge area dis pl ays where time is sp ent in your game. When it is selected, the lower p ane dis pl ays hierarchical time data for the selected frame.CPU使用率区域显示你的游戏在哪里花费时间。当这个区域被选中,下部窗格中显示选定的帧层次化的时 间数据。Hierarchy mode:DispI ays hierarchical time data.层级模式(Hierarchy mode ):显示层次化的时间数据。Group Hierarchy mod

32、e:Groups time data into logical groups (Rendering, Physics,Scripts etc.). Because children of any group can be in different group (e.g. some scri ptmight call rendering functions), the p ercentages of group times often add up to morethan 100%. (This is not a bug.)组层级模式(Group Hierarchy mode ):成逻辑组的组时

33、间数据(渲染( Rendering ),物理(Physics ),脚本(Scripts )等)。因为任何组的子成员,可在不同的组(例如一些脚本可能调用渲染功能),组时间的百分比往往加起来超过100 %。(这不是一个错误。)The way the CPU chart is stacked can be reordered by simply dragging chart labels up &down.CPU的使用率(CPU Usage)图表堆叠方式,可以通过简单的上下拖动图表标签进行重新排序。When an item is selected in the lower p ane, its co

34、ntribution to the CPU chart is highlighted(and the rest are dimmed). Clicking on an item again de-selects it. 当在下部窗格中选择一个项目,对应到 色)。再次点击这个项目就会取消选择。CPU的使用率(CPU Usage)图表上会高亮显示(和其余部分为灰O ProfilerAdd AraQi RKord De*p ProfifeFrame; 22 5 / 4191. CPU U&ageJ 尺 RenderingI 匚 Arba&Callertar 門护i匚s Ol kiersJSrrll1

35、 HierarchyFunaioFiTouiSelf51,1MerrwiyJifnc msT Camen Render20 B577 Drawing47丄幣t4.2K20 ES.ii MeshRcnderer.Render15 EK12%650 E1.7Shader.SetPais- - 頂吨hSaU理0 B1,&b ski nned Mesh Rend e r e r .Re nde r12KOjOWC0 b0.11亠 Partirlekenderer.lender0渤10 BO.lfc- Culllir20 BO.lCUIText.Render0.7W20 BaiCameraJnnageE

36、fFetts20 BC.OMeshskinning10 B1.2Shader.Set Pass is selected and its contribution is highlighted in the chart.Shader .SetPass被选中,图表中高亮显示。In the hierarchical time data the self time refers to the amount of time sp ent in a p articularfunction not including the time spent calling sub-functions. In the

37、screenshotabove,forexa mple 51.2% of time is sp ent in the Camera.Render function. This function does a lot of work and calls the various drawing and culling functions. Excluding all these functions only 0.8% of time is sp ent actually in the Camera.Render function.在分层的时间数据的自我时间(self time )指花费在特定函数的

38、时间,不包括调用子函数所花费的时间。在上面的截图,例如51.2 %的时间花费在 Camera.Render 函数。这个函数做了很多工作,并调用各种绘图和剔除的函数。实际上排除了所有这些功能只有0.8 %的时间花费在 Camera.Render 函数。Ren deri ng Area渲染区域C? Profiler 細d Fr-D|-ilrI 小 iR-coridi Deep Protik , Prafil* Editor Aqti-ae ProSler XRendertig G Ofw OJIi B Tri ar mlet 口 唤Fraire: 4119/ 433Sraw talk: I Tri

39、s;76D Verts 525Botched DrawCflIls: 0 BatchedTrrs: 0 Bitched Verri 0Used Textures: 1 / 0 BRerderTextures, 0 / 0 &KerdcrTcxrure Switches 0Screen/ 2專 MBVRAM usage: IS MB to 2.7 MHof 25乱0 HE)VBO Total: 15 = 170.1 KfiVBUploadi. 0=C&IB Uploads. 0 = OBShadowCQiteii.O Visible 5Mnned Meshes?0 AniirMians. 0Th

40、e Rendering area dis pl ays rendering statistics. The Number of Draw Calls, Triangles andVertices renderedis dis pl ayedgrap hicalin the timeline. The Lowerp ane dis pl aysmorerendering statisticsand these more closely match the ones shown in the GameViewRendering Statistics渲染区域显示渲染统计数据。window.Draw

41、Calls ,三角形和顶点渲染数量,在时间轴上显示以图形的方式。下部窗格中显示更多渲染统计数据,这些数据与在游戏视图渲染统计数据窗口显示的数据相匹配。3 ProfilerAdd Area0 Record Deep FrofiieFrame: E32 / 4L9MemoryTotii Allsat4dTewr urt WeifTtdiy I Ohijiect Cou ntMcdwry :Total: 2GG.2 MB Delta: 0 6Texturei: 525 / IS.G MB Meshes:/ 7.9 MEAnimationCJips: 2S / 0.6 MB toraJ -Ohjeci

42、 Couirii: 6537The Memory area dis pl ays some memory usage data:内存区域显示一些内存使用的数据:Total Allocated is the total RAM used by the appi ication. Note that in the Unity Editorthis is memory used by everything in the editor; game builds will use much less.总分配(Total Allocated )是应用程序所使用的总内存。请注意,在Unity编辑器,这是在编

43、辑器中的一切使用的内存;游戏构建后将使用少得多的内存。Texture Memory is the amount of video memory used by the textures in the currentframe.纹理内存 仃exture Memory )是在当前帧中纹理占用的显存大小。Object Count is the total number of Objects that are created. If this number rises overtime then it means your game is creating some objects that are

44、never destroyed.对象数(Object Count)是所创建的对象的总数。如果这个数字随时间不断上升,那么它意味着你的游戏在不断创造一些从不销毁的对象。Audio Area音频区域O ProfilerAijd Frifiler Audio B AuditJ 1敢 RmdhI Deep Protil t , Profil* Editor b tiire Profii#rPhysics Area物理学区域PfJviing Souitce&: 0Paused Sources. 0Audio Voices. 0Audio CPUU呂鱼护:0第Audio Memory: ZS5.0 KBM

45、ix Audio Memory Lkdg史 JBS .0KBThe Audio area dis pl ays audio statistics:音频区域显示音频统计数据:Playing Sources is the total pl aying sources in the scene at a sp ecific frame. Monitorthis to see if audio is overloaded.播放源(Playing Sources )是在特定的帧,场景上播放源的总数。监视此,看看音频是否被重载。? Paused Sources is the total p aused s

46、ources in the scene at a sp ecific frame. 暂停源(Paused Sources )是在特定的帧,场景上暂停源的总数。Audio Voice is the actually number of audio (FMOD channels) voices used.PlayOneShot is using voices not shown in Playing Sources.音频声音(Audio Voice )是实际使用音频(FMOD频道)声音的数量。 PlayOneShot 使用的是不会显示在播放源(P laying Sources)的声音。? Audi

47、o Memory is the total RAM used by the audio engine. 音频内存(Audio Memory )音频引擎所使用的内存总量。CPU usage can be seen in the bottom. Monitor this to see if Audio alone is taking up too muchCPU.在底部可见的CPU使用率。监察这,看看音频是否单独占用太多的CPU。O Profiler Aijd Fwfi徒 rFrarrw; 匚 urrsnt1报船嗣Active Rigidbodies ISteeping Kigidbodtes 0

48、Number of Contacts: 0Static Colliders.: 0 vnamic Colliders. LThe Physics area shows the following statistics about the p hysics in the scene:-物理学区域显示下列有关场景物理学的统计:Active Rigidbodies is the number of rigidbodies that are not currently slee ping (ie.they are moving or just coming to rest).Active Rigidb

49、odies是指当前活动的刚体数(也就是说,他们正移动或仅刚刚静止)Slee ping Rigidbodies is the number of rigidbodies that are compi etely at rest andtherefore dont need to be up datedactively by the p hysics engine (see RigidbodySlee ping for further details).Sleeping Rigidbodies是指哪些静止的刚体数,因此,不需要物理引擎主动更新(详情参见RigidbodySleeping )。Num

50、ber of Contacts is the total number of po ints of contact between all colliders inthe scene.Number of Contacts(接触点数)是指场景中的所有接触点的总数。Static Colliders is the number of colliders attached to non-rigidbody objects (ie,objects which never move under p hysics).Static Colliders(静态碰撞器)是指附加到非刚体物体的碰撞器数量(也就是说,物体从来不会在物理作用下移动)。Dynamic Colliders is the

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论