作为iOS开发者来讲,当我们的开发完毕或者在开发的过程中需要对APP的整个性能进行检测,如查看有无内存泄漏、内存的分配、CPU使用率、APP的功耗。这些操作是无法在编写程序的时候去完成的。
Apple为我们提供了Instruments去完成这些我们在编程时无法完成的操作,帮助我们提升APP的性能。下面简单介绍一下如何使用Instruments
1.Instruments的启动
xcode_product_profile_menu_2x.png
在Xcode中选择Product>Profile即可进入Instruments功能选择面板如下
instruments_profilingtemplate_dialog_2x.png
-
Filter buttons: 选择Instruments标准库中的功能或者自定义功能或者你最近使用过的功能
-
Template list: 所有的功能列表
-
Template description 对所选择功能的简单描述
-
Open an Existing File 打开之前保存过的检测文件
点击Choose即可进入性能检测界面如下 !
instruments_loadedtrace_file_2x.png
2.检测界面各个模块的功能 !
instruments_trace_document_withdata_2x.png
-
Timeline pane: 相等时间间隔下,检测仪器所取的数据展示区域
-
Detail pane: 相等时间间隔下索取程序执行的操作