Android手机用Unity Profiler查看性能
2016-06-17 15:43
471 查看
本文为原创,如需转载请标注原址:http://blog.csdn.net/cube454517408/article/details/51700492
使用Unity Profiler查看Android手机上运行性能数据,以下是官方文档:
Android
Remoteprofiling can be enabled on Android devices through two different paths : WiFiorADB.
For WiFiprofiling, follow these steps:
Make sure to disable Mobile Data on your Android device.
Connect your Android device to your WiFi network.
Attach your device to your Mac/PC via cable, check the “Development Build” and “Autoconnect Profiler” checkboxes in Unity’s build settings dialog, and hit “Build & Run” in Unity Editor.
When the app launches on the device, open the profiler window in Unity Editor (Window->Profiler)
If the Unity Editor fails to autoconnect to the device, select the appropriate device from the Profiler Window Active Profiler drop down menu.Note: The Android device and host computer (running the Unity Editor) must both be
on the samesubnet for the device detection to work.
For ADB profiling,follow these steps:
Attach your device to your Mac/PC via cable and make sure ADB recognizes the device (i.e. it shows inadb devices list).
Check the “Development Build” checkbox in Unity’s build settings dialog, and hit “Build & Run”.
When the app launches on the device, open the profiler window in Unity Editor (Window->Profiler)
Select the AndroidProfiler(ADB@127.0.0.1:54999) from the Profiler Window Active Profiler drop down menu.Note: The Unity editor will automatically create an adb tunnel for your application when you press “Build & Run”.
If you want to profile another application or you restart the adb server you have to setup this tunnel manually. To do this, open a Terminal window / CMD prompt and enter:
adb forward tcp:54999 localabstract:Unity-{insert bundle identifier here}
Note: Theentry in the drop down menu is only visible when the selected target isAndroid.
If you areusing a firewall, you need to make sure that ports 54998 to 55511 are open inthe firewall’s outbound rules - these are the ports used by Unity for remoteprofiling.
官方这里介绍了两种联调方式:wifi和用数据线连接的adb模式,这里推荐用adb模式,数据反馈更为及时。这里我们采用adb来联调。
简单罗列一下官方步骤:
1. 将你的手机设备采用adb的方式与PC/Mac相连
2. 发布Unity Android Apk时,勾选“Development Build”和“AutoConnect
Profiler”选项
3. 开始运行手机程序后,点开Window->Profiler,选择AndroidProfiler(ADB@127.0.0.1:54999)
4. 手动打开adb的连接,打开CMD,输入:adb forward tcp:54999localabstrack:Unity-com.WJ.SwDemo2;(注意:这里的com.WJ.SwDemo2请填写运行应用程序的Bundle
Identifier)
注意:这里要注意防火墙不能屏蔽端口:54998-55511
下面记录一下联调过程中发现的问题和解决方案,以供参考~
1.
开启防火墙端口54998-55511:
2. 输入adb联调命令:
打开CMD(快捷键WIN+R),
输入:adb forwardtcp:54999 localabstract:Unity-com.WJ.SwDemo2,回车;
如上图:
1) 回车后,还无法连接,输入:adb nodaemon server,发现端口5037已被占用
2) 输入:netstat –ano | findstr “5037”,查看5037被哪些进程占用
3) 输入:taskkill /f /pid 5900(这里是上面查出的进程pid),终止占用5037的进程
4) 输入:adb forward tcp:54999 localabstract:Unity-com.WJ.SwDemo2,发现5037还不能连
5) 输入:adb start-server,重新启动adb,然后再输入4)所示adb连接代码
6) 打开手机应用程序,并确保Profiler选择AndroidProfiler(ADB@127.0.0.1:54999)模式,即可在电脑上查看应用的性能数据
使用Unity Profiler查看Android手机上运行性能数据,以下是官方文档:
Android
Remoteprofiling can be enabled on Android devices through two different paths : WiFiorADB.
For WiFiprofiling, follow these steps:
Make sure to disable Mobile Data on your Android device.
Connect your Android device to your WiFi network.
Attach your device to your Mac/PC via cable, check the “Development Build” and “Autoconnect Profiler” checkboxes in Unity’s build settings dialog, and hit “Build & Run” in Unity Editor.
When the app launches on the device, open the profiler window in Unity Editor (Window->Profiler)
If the Unity Editor fails to autoconnect to the device, select the appropriate device from the Profiler Window Active Profiler drop down menu.Note: The Android device and host computer (running the Unity Editor) must both be
on the samesubnet for the device detection to work.
For ADB profiling,follow these steps:
Attach your device to your Mac/PC via cable and make sure ADB recognizes the device (i.e. it shows inadb devices list).
Check the “Development Build” checkbox in Unity’s build settings dialog, and hit “Build & Run”.
When the app launches on the device, open the profiler window in Unity Editor (Window->Profiler)
Select the AndroidProfiler(ADB@127.0.0.1:54999) from the Profiler Window Active Profiler drop down menu.Note: The Unity editor will automatically create an adb tunnel for your application when you press “Build & Run”.
If you want to profile another application or you restart the adb server you have to setup this tunnel manually. To do this, open a Terminal window / CMD prompt and enter:
adb forward tcp:54999 localabstract:Unity-{insert bundle identifier here}
Note: Theentry in the drop down menu is only visible when the selected target isAndroid.
If you areusing a firewall, you need to make sure that ports 54998 to 55511 are open inthe firewall’s outbound rules - these are the ports used by Unity for remoteprofiling.
官方这里介绍了两种联调方式:wifi和用数据线连接的adb模式,这里推荐用adb模式,数据反馈更为及时。这里我们采用adb来联调。
简单罗列一下官方步骤:
1. 将你的手机设备采用adb的方式与PC/Mac相连
2. 发布Unity Android Apk时,勾选“Development Build”和“AutoConnect
Profiler”选项
3. 开始运行手机程序后,点开Window->Profiler,选择AndroidProfiler(ADB@127.0.0.1:54999)
4. 手动打开adb的连接,打开CMD,输入:adb forward tcp:54999localabstrack:Unity-com.WJ.SwDemo2;(注意:这里的com.WJ.SwDemo2请填写运行应用程序的Bundle
Identifier)
注意:这里要注意防火墙不能屏蔽端口:54998-55511
下面记录一下联调过程中发现的问题和解决方案,以供参考~
1.
开启防火墙端口54998-55511:
2. 输入adb联调命令:
打开CMD(快捷键WIN+R),
输入:adb forwardtcp:54999 localabstract:Unity-com.WJ.SwDemo2,回车;
如上图:
1) 回车后,还无法连接,输入:adb nodaemon server,发现端口5037已被占用
2) 输入:netstat –ano | findstr “5037”,查看5037被哪些进程占用
3) 输入:taskkill /f /pid 5900(这里是上面查出的进程pid),终止占用5037的进程
4) 输入:adb forward tcp:54999 localabstract:Unity-com.WJ.SwDemo2,发现5037还不能连
5) 输入:adb start-server,重新启动adb,然后再输入4)所示adb连接代码
6) 打开手机应用程序,并确保Profiler选择AndroidProfiler(ADB@127.0.0.1:54999)模式,即可在电脑上查看应用的性能数据
相关文章推荐
- 深入理解PHP7内核之FAST_ZPP
- Flex 性能优化常用手法总结
- oracle 性能优化建议小结
- Lua性能优化技巧(一):前言
- Lua性能优化技巧(五):削减、重用和回收
- Lua性能优化技巧(三):关于表
- Lua性能优化技巧(四):关于字符串
- 详解SQL Server 2008工具SQL Server Profiler
- SQL Server 2016 查询存储性能优化小结
- MySQL性能优化 出题业务SQL优化
- PowerShell脚本性能优化技巧总结
- SQL SERVER性能优化综述(很好的总结,不要错过哦)第1/3页
- MySQL Index Condition Pushdown(ICP)性能优化方法实例
- Ajax无刷新分页的性能优化方法
- dedecms负载性能优化实例,三招让你的dedecms快10倍以上第1/2页
- 如何减少浏览器的reflow和repaint
- javascript日期处理函数,性能优化批处理
- Listview加载的性能优化是如何实现的
- JavaScript 性能优化小结
- JQuery教学之性能优化