建设企业网站要多少钱,如何增加网站的流量,制作公司网页,什么叫关键词举例Overview: . Profiler简介 . Profiler各模块介绍 . 各平台下Profiler的使用 . 基于Profiler的优化定位 . Profiler的主要参数详解 . Profiler案例 Profiler简介 Profiler 是Unity中分析性能开销的工具 • 各种开销一览无遗 • 可跨平台使用#xff08;Web、PC、iOS、Android、…Overview: . Profiler简介 . Profiler各模块介绍 . 各平台下Profiler的使用 . 基于Profiler的优化定位 . Profiler的主要参数详解 . Profiler案例 Profiler简介 Profiler 是Unity中分析性能开销的工具 • 各种开销一览无遗 • 可跨平台使用Web、PC、iOS、Android、WP • 只有Unity Pro版本才开启该功能 Profiler各模块介绍 Profiler 包含6块内容的分析 • CPU Usage • GPU Usage • Memory • Rendering • Audio • Physics • Unity 4.1 版更新内容 • 提供更细节的Memory分析 • 可通过IP地址来监视游戏的运行状况 • Unity 4.2 版更新内容 • 对象引用关系的显示 Profiler各模块介绍
*********************CPU Usage********************
1. 主要函数调用的CPU时间开销 : (1)
1.1.最耗时的操作会显示在Hierarchy面板的最上方 (2) 2. Mono分配内存的情况 :
2. 1. 在GC Alloc栏 (3) 3. Profiler可以自定义需要统计的代码块
3.1. 使用Profiler.BeginSample 和 Profiler.EndSample 4. Deep Profiling
4.1 同样使用之前的代码作为例子在开启Deep Profiling后Profiler里的内容变得更为详细 *********************GPU Usage********************
1. 统计Drawcall的数量及耗费时间
2. Profiler中Drawcall是广义上的Drawcall包含 2. 1.GPU Stage切换 2. 2. Clear操作 2. 3.将顶点数据传输到GPU的开销 2. 4. 绘制调用狭义上的Drawcall 2. 5. Rendering模块和Game Statistics里统计的是这种Drawcall 3. Memory Profiler
3.1 查看内存使用细节 3.1.1 点击 可看各种资源内存占用的情况 31.2 点击后获得当前内存情况。 3.2 内存引用关系图 3.2.1 可以观察到一个对象在哪里被引用利于检测内存泄露 各平台下Profiler的使用
*********************Editor*******************
1. 在Window/Profiler菜单下可打开Profiler窗口
2. 如果在编辑器下运行游戏可直接看到Profiler信息
3. 一些常用的操作 3.1Recored 记录或暂停 3.2 Deep Profile 深度Profiling分析更多细节 3.3Profile Editor 是否记录Editor相关的开销 3.4Active Profiler 激活指定的目标进行Profiling 3.5Clear 清空已有的Profiler信息 3.6Frame 帧 *********************针对发布的程序做Profiling*******************
勾选”Development Build”和”Autoconnect Profiler”选项 2.如果发布的程序在本机上执行Profiler会自动连接
3.如果在其他机器上执行需要在Active Profiler处输入IP进行连接。 4. Profiler连接目标平台所使用的端口
• MulticastPort : 54998 • ListenPorts : 55000 - 55511 • Multicast(unittests) : 55512 - 56023 5. IOS/Android设备
• 在Unity的Building Setting中勾选Autoconnect Profiler及Development Build • 发布游戏到目标设备 • 连接目标设备到Wifi网络需要和运行Editor的PC在一个Wifi网段 • 运行设备上的游戏 • 在Editor的Profiler(Active Profiler)里输入设备的IP进行远程连接 • 连接上后即可在Editor的Profiler窗口中查看Profiling的信息 *************在各个平台上做Profiling的注意事项**************
做Profiling时需要应用程序获得焦点
2. 如果自动连接不生效请尝试手动设置IP连接使用Active Profiler
3. 发布时勾上Development Build和Autoconnect Profiler 基于Profiler的优化定位
1. Pareto Analysis 帕累托分析法
1.1 20%的函数通常导致了 的性能问题
1.2 使用编辑器 来得到最有问题的函数调用并且在第一时间优化它们 2. Profiler.BeginSample()/Profiler.EndSample()
2.1更加清楚地分析函数中的各个部分
3. Debug.Log
3.1 Debug.Log(Hello); //输出字符串到控制台
3.1 Debug.Log(Hello,gameObject); //关联对象gameobject