Activity Monitor,官方解释为:(活动监视器)即实时显示CPU、内存和网络的使用情况,记录由虚拟内存大小测量的系统负载。用一句大白话来说,Activity Monitor类似Windows中的任务管理器,可以实时查看进程占用的CPU、内存的使用量。
 
一、Activity Monitor的介绍和大致使用
具体操作步骤,
首先从Xcode中运行Instruments,在顶部的菜单栏中,选择Product,选择Profile(快捷键:Command + I)。会调用Instruments,选择Activity Monitor 模板

Activity Monitor打开之后是这个样子,所有都是空的
 
 当运行的设备和运行的app都准备好了,我们开始运行Activity Monitor,点击左上角的红色圆点按钮,开始记录手机中CPU和内存的使用情况,得到下图:
我们分析一下这些图的意思:
%CPU:不同进程对CPU的占比
CPU Time:CPU运行时间
Real Memory Usage:进程使用的内存量,用了饼状图和柱状图展示
 
上图只是这些数据的大概结果我们可以去查看具体的数据,点击上图4个任意自己想要查看信息的图片,分析的结果有4种分析结果【Summary、Parent Child、Samples、Console】,我们一个个来分析
 
(1)Summary(Summary of data) ---------Process(进程)使用内存、CPU使用时长等摘要信息
其中参数的含义如下:                             
process id ——进程id 
process name ——进程名 
user name——用户名
%CPU——cpu占比
threads——线程
real mem——真正使用的内存 
virtual mem——虚拟内存
architecture——架构 
cpu time——CPU时间 
sudden term——突然项(N/A:不适用) 
 
(2)Parent Child(

parent child information)-----父进程和子进程的关系,以及各个进程的概要信息

 
 它的参数与Summary是一样的,内容也是一样的。但是它具有层级关系(即父子关系),子进程在父进程的下一层级。(父进程上,可以展开、关闭它的所有子进程)
 
(3)Samples(a list of samples) ----一系列抽样(即不同时间,CPU使用时间、内存使用情况的样本值)
参数的含义如下:
  • Physical Memory Wired——操作系统占用的内存
  • Physical Memory Active——除操作系统外其它进程占用的内存
  • Physical Memory Inactive——最近被释放的内存
  • Physical Memory Used——profiling当前进程时使用的总内存
  • Physical Memory Free——当前的可用内存
  • Total VM Size——虚拟内存的占用量
 
(4)Console,即控制台输出的日志(Log)信息
 
提示:
Activity Monitor默认配置了在Timeline面板中显示的内容,包括TotalVMSizeCPUTotalLoadCPUUserLoadCPUSystemLoad,在使用时可以根据自己的需要选择相关的分析内容进行显示,并且不同的内存使用部分可以使用不同的颜色加以区分,下面就是Activity Monitor在使用过程中的界面截图,在右下角可选择内存相关的分析内容。

 

下面我们将根据需要,对Activity Monitor监控的内容进行分类介绍:
  
二、Activity Monitor监控内存使用情况

Examining Memory Usage with the Activity Monitor Trace Template

The Activity Monitor trace template monitors overall system activity and statistics, including CPU, memory, disk, and network. It consists of the Activity Monitor instrument only, although you can add additional instruments to a trace document you’ve created with the template, if you desire. You’ll see later that the Activity Monitor is also used to monitor network activity on iOS devices.

The Activity Monitor instrument captures information about the load on the system measured against the virtual memory size. It can record information from a single process or from all processes running on the system. The Activity Monitor instrument provides you with four convenient charts for a quick, visual representation of the collected information. The two charts that specifically describe memory usage are:

Real Memory Usage (bar graph). Shows the top five real memory users in a bar graph.

Real Memory Usage (pie chart). Shows the top five real memory users with the total memory used displayed.

下图为Activity Monitor instrument with charts

The Record Settings area in the inspector sidebar includes a list of system statistics, which can be configured to appear in the track pane and graphically represent collected data. Select a statistic’s checkbox to see it graphed in the track pane. Click the shape or the color well to change how a statistic appears in the track pane.

There are a number of statistics the Activity Monitor instrument supports, but the following ones are memory-specific:

Physical Memory Wired

Physical Memory Active

Physical Memory Inactive

Physical Memory Used

Physical Memory Free

Total VM Size

VM Page In Bytes

VM Page Out Bytes

VM Swap Used

If one of the statistics above doesn’t appear under System Statistics, locate it under “Select statistics to list” and click its checkbox to include it in the list.

 
三、Activity Monitor监控CPU情况 
There are a number of statistics the Activity Monitor instrument supports, but the following ones are memory-specific:

CPUTtotalLoad
CPUUserLoad
CPUSystemLoad
CPUNiceLoad

If one of the statistics above doesn’t appear under System Statistics, locate it under “Select statistics to list” and click its checkbox to include it in the list. 
下图为Activity Monitor instrument tracing CPU packets
 
四、Activity Monitor监控网络情况 

By default, the Activity Monitor template isn’t set up to display network activity. Therefore, you need to enable the desired network-related statistics in the Record Settings area in the inspector sidebar for the Activity Monitor instrument to see which processes are sending and receiving information.

There are a number of statistics the Activity Monitor instrument supports, but the following ones are network-specific:

Net Packets In
Net Bytes In
Net Packets Out
Net Bytes Out
Net Packets In Per Second

Net Packets Out Per Second

Net Bytes In Per Second

Net Bytes Out Per Second

If one of the statistics above doesn’t appear under System Statistics in the Record Settings inspector, locate it under “Select statistics to list” and click its checkbox to include it in the list.

Once you have gathered network activity for your app, examine it carefully to pinpoint areas where your app is sending out excessive amounts of information and therefore tying up valuable device resources. When you minimize the amount of information sent and received, you can benefit from increased performance and response times in your app.

下图为Activity Monitor instrument tracing network packets

Instruments之Activity Monitor使用入门的更多相关文章

  1. Instruments_Activity Monitor使用入门

    Activity Monitor,官方解释为:(活动监视器)即实时显示CPU.内存和网络的使用情况,记录由虚拟内存大小测量的系统负载.用一句大白话来说,Activity Monitor类似Window ...

  2. [转]Performance Analysis Using SQL Server 2008 Activity Monitor Tool

    本文转自:https://www.mssqltips.com/sqlservertip/1917/performance-analysis-using-sql-server-2008-activity ...

  3. Activity Monitor 闪退 & 无法进入睡眠

    情况描述 黑苹果主机突然无法进入睡眠. 考虑到可能是后台程序阻碍了系统正常进入睡眠, 于是想要通过Activity Monitor查看系统的活动情况,然而,Activity Monitor闪退. 重 ...

  4. Activity工作流(2)-入门安装运行第一个例子

    转: Activity工作流(2)-入门安装运行第一个例子 置顶 2017年05月24日 15:58:50 li_ch_ch 阅读数:24432   版权声明:本文为博主原创文章,未经博主允许不得转载 ...

  5. Activity工作流框架入门(二)API使用DEMO

    工作流API使用Demo package activity.demo.test; import java.io.File; import java.io.FileInputStream; import ...

  6. 增加Activity Monitor中的作业保存数量

    在Master Server的注册表中加入如下两个键值即可: (1500的单位是小时)  

  7. 移动app性能测试(待完善)

    移动终端性能测试是测试手机终端是否符合特定性能指标的测试,包括有:内存.CPU.电量.流量.流畅度.时延等 测试准备:测试账号.测试需求.测试用例.待测手机.待测应用包.测试工具.测试电脑 1.  时 ...

  8. Instruments 使用指南

    Instruments 用户指南 http://cdn.cocimg.com/bbs/attachment/Fid_6/6_24457_90eabb4ed5b3863.pdf 原著:Apple Inc ...

  9. Instruments模板介绍(更新中...)

    第一章.Instruments(仪器)快速入门 Instruments可以用来收集关于一个或者多个系统进程的性能和行为的数据,并跟踪睡着时间产生的数据.它提供了好几个分析模板: Blank 任何类型都 ...

随机推荐

  1. Xbox One手柄 + Xbox Wireless Adapter PC无线适配器驱动安装、配对全流程

    以下步骤在Windows 7系统中操作.XBox One手柄+无线适配器并非仅只能在Windows 10中使用. 一点感想:微软的XBoxOne手柄实在是好东西,但产品使用说明与文档实在太垃圾,翻遍官 ...

  2. ElasticSearch 内存那点事【转】

    “该给ES分配多少内存?” “JVM参数如何优化?““为何我的Heap占用这么高?”“为何经常有某个field的数据量超出内存限制的异常?““为何感觉上没多少数据,也会经常Out Of Memory? ...

  3. 如何取消Visual Studio Browser Link

    VS2013.2015新建MVC网站并浏览后,页面默认自动启用Browser Link功能 解决方法,只需要在web.config中添加配置节点即可 <appSettings> <a ...

  4. java-信息安全(十一)-非对称加密算法ECC

    概述 信息安全基本概念: ECC算法(Elliptic curve cryptography,椭圆曲线密码学) ECC 椭圆加密算法(ECC)是一种公钥加密体制,最初由Koblitz和Miller两人 ...

  5. .Net Framework4.5.2 源码命名空间简析

    Miscosoft目前除.Net Core开源外,对于.Net4.5.1 , 4.5.2等后续版本同样开源.资源中包含sln,csproj等以方便我们在vs中打开它们,不过我们不能编译它,因为它缺少r ...

  6. SpringBoot------如何将项目打成war包

    1.修改pom.xml文件 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http:/ ...

  7. 从Elasticsearch来看分布式系统架构设计

    分布式系统类型多,涉及面非常广,不同类型的系统有不同的特点,批量计算和实时计算就差别非常大.这篇文章中,重点会讨论下分布式数据系统的设计,比如分布式存储系统,分布式搜索系统,分布式分析系统等. 我们先 ...

  8. Qt编写软件运行时间记录(开源)

    在早期开发的软件中,尤其是初学者入门者写的软件,软件运行久了,难免遇到意外崩溃的时候,可是大部分的运行设备可能在现场客户那,需要记住每一次从软件启动后到软件意外关闭前的运行时间,需要记录的信息包括:编 ...

  9. css3整理--box-sizing

    box-sizing语法: box-sizing : content-box || border-box || inherit 参数取值: content-box:此值为其默认值,其让元素维持W3C的 ...

  10. Xcode连接TFS Git用户名和密码不正确解决方案

    团队要将原来搭建的Git服务全部迁移到TFS的Git上统一管理,迁移的过程非常顺利.当要用Xcode或者SourceTree连接TFS Git(我们的TFS身份认证是基于Windows的,使用HTTP ...