Instruments_Activity Monitor使用入门

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

Activity Monitor打开之后是这个样子,所有都是空的
Instruments_Activity Monitor使用入门第2张
 
 当运行的设备和运行的app都准备好了,我们开始运行Activity Monitor,点击左上角的红色圆点按钮,开始记录手机中CPU和内存的使用情况,得到下图:
Instruments_Activity Monitor使用入门第3张
我们分析一下这些图的意思:
%CPU:不同进程对CPU的占比
CPU Time:CPU运行时间
Real Memory Usage:进程使用的内存量,用了饼状图和柱状图展示
 
上图只是这些数据的大概结果我们可以去查看具体的数据,点击上图4个任意自己想要查看信息的图片,分析的结果有4种分析结果【Summary、Parent Child、Samples、Console】,我们一个个来分析
 
(1)Summary(Summary of data) ---------Process(进程)使用内存、CPU使用时长等摘要信息
Instruments_Activity Monitor使用入门第4张
其中参数的含义如下:                             
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)-----父进程和子进程的关系,以及各个进程的概要信息

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

Instruments_Activity Monitor使用入门第8张

下面我们将根据需要,对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

Instruments_Activity Monitor使用入门第9张

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.

Instruments_Activity Monitor使用入门第10张

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情况 
Instruments_Activity Monitor使用入门第11张
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
Instruments_Activity Monitor使用入门第12张
 
四、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.

Instruments_Activity Monitor使用入门第13张

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使用入门第14张 

 
 
 
参考以下文章:

小白学习instrument之Activity Monitor

Monitor Memory Usage Using Activity Monitor

 转载请注明出处:http://www.cnblogs.com/JuneWang/p/4789910.html

免责声明:文章转载自《Instruments_Activity Monitor使用入门》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇ubuntu一些基本软件安装方法集成WPF与Windows窗体下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

TableView的优化

一:什么是TableView的优化以及为什么要优化 1)CPU(中央处理器)和GPU(图形处理器):CPU主要从事逻辑计算的一些工作;GPU主要从事图形处理方面的工作。 2)CPU和GPU的共同点: 都有自己的缓存体系,都有自己的数字和逻辑运算单元,都为了完成计算任务而设计。 3)CPU和GPU的不同点: CPU的核少但是核内空间非常大,能够处理复杂的逻...

Linux内存描述之内存节点node--Linux内存管理(二)

1 内存节点node 1.1 为什么要用node来描述内存 这点前面是说的很明白了, NUMA结构下, 每个处理器CPU与一个本地内存直接相连, 而不同处理器之前则通过总线进行进一步的连接, 因此相对于任何一个CPU访问本地内存的速度比访问远程内存的速度要快 Linux适用于各种不同的体系结构, 而不同体系结构在内存管理方面的差别很大. 因此linux内核...

Linux Cache 机制

在阅读文章前,您应该具备基本的存储器层次结构知识,至少要了解局部性原理。要详细了解cache基本原理,可以参考本书《深入理解计算机系统》中存储器体系结构一章:   带着疑问来看文章,cache对于程序员是不可见的,它完全是由硬件控制的,为什么在linux内核中还有cache.h这个头文件,定义了一些关于cache的结构? 1. cache概述 cache,...

如何区分cpu_scale、max_freq_scale、cpu_orig_capacity、cpu_capacity?

CPU,即中央处理器,它最有用的属性就是算力性能。通过之前的知识学习,了解了linux kernel中对cpu算力形象化的表示:cpu capacity。 1、从cpu拓扑结构、sched_doamin/sched_group的建立过程来看,就包含了对cpu capcity的初始建立。 2、而cpu的算力和cpu运行的freq又极其相关,因此对cpu调频的...

python电脑结构、ARP协议、单位转换、字节bytes、字符串与字节关系等知识总结

目录 一、计算机五大部件 二、程序运行的过程 三、ARP协议 四、单位转换 五、数据类型:字节bytes 六、字符串和字节的关系 一.计算机五大部件 电脑之父——冯·诺伊曼提出了计算机的五大部件:输入设备、输出设备、存储器、运算器和控制器。 我们把键盘和鼠标叫输入设备。 输入设备: 向电脑输入数据和信息的设备。除了键盘。除了键盘鼠标,其他输入设备还包括触...

Jmeter系列(38)- 详解性能监控工具 nmon

如果你想从头学习Jmeter,可以看看这个系列的文章哦 https://www.cnblogs.com/poloyy/category/1746599.html 前言 做性能测试,服务器监控是至关重要的,前面也讲了通过 ServerAgent 去监控服务器 这一篇博文将详细讲解 nmon 监控工具 nmon 官方介绍 nmon是一种在 AIX 与各种...