国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

Instruments_ActivityMonitor使用入門

2019-11-14 18:22:15
字體:
供稿:網(wǎng)友
Activity Monitor,官方解釋為:(活動監(jiān)視器)即實時顯示CPU、內(nèi)存和網(wǎng)絡(luò)的使用情況,記錄由虛擬內(nèi)存大小測量的系統(tǒng)負載。用一句大白話來說,Activity Monitor類似Windows中的任務(wù)管理器,可以實時查看進程占用的CPU、內(nèi)存的使用量。
 
一、Activity Monitor的介紹和大致使用
具體操作步驟,
首先從Xcode中運行Instruments,在頂部的菜單欄中,選擇PRoduct,選擇Profile(快捷鍵:Command + I)。會調(diào)用Instruments,選擇Activity Monitor 模板


Activity Monitor打開之后是這個樣子,所有都是空的
 
 當運行的設(shè)備和運行的app都準備好了,我們開始運行Activity Monitor,點擊左上角的紅色圓點按鈕,開始記錄手機中CPU和內(nèi)存的使用情況,得到下圖:
我們分析一下這些圖的意思:
%CPU:不同進程對CPU的占比
CPU Time:CPU運行時間
Real Memory Usage:進程使用的內(nèi)存量,用了餅狀圖和柱狀圖展示
 
上圖只是這些數(shù)據(jù)的大概結(jié)果我們可以去查看具體的數(shù)據(jù),點擊上圖4個任意自己想要查看信息的圖片,分析的結(jié)果有4種分析結(jié)果【Summary、Parent Child、Samples、Console】,我們一個個來分析
 
(1)Summary(Summary of data) ---------Process(進程)使用內(nèi)存、CPU使用時長等摘要信息
其中參數(shù)的含義如下:                             
process id ——進程id 
process name ——進程名 
user name——用戶名
%CPU——cpu占比
threads——線程
real mem——真正使用的內(nèi)存 
virtual mem——虛擬內(nèi)存
architecture——架構(gòu) 
cpu time——CPU時間 
sudden term——突然項(N/A:不適用) 
 
(2)Parent Child(

parent child information)-----父進程和子進程的關(guān)系,以及各個進程的概要信息

 
 它的參數(shù)與Summary是一樣的,內(nèi)容也是一樣的。但是它具有層級關(guān)系(即父子關(guān)系),子進程在父進程的下一層級。(父進程上,可以展開、關(guān)閉它的所有子進程)
 
(3)Samples(a list of samples) ----一系列抽樣(即不同時間,CPU使用時間、內(nèi)存使用情況的樣本值)
參數(shù)的含義如下:
  • Physical Memory Wired——操作系統(tǒng)占用的內(nèi)存
  • Physical Memory Active——除操作系統(tǒng)外其它進程占用的內(nèi)存
  • Physical Memory Inactive——最近被釋放的內(nèi)存
  • Physical Memory Used——profiling當前進程時使用的總內(nèi)存
  • Physical Memory Free——當前的可用內(nèi)存
  • Total VM Size——虛擬內(nèi)存的占用量 
 
(4)Console,即控制臺輸出的日志(Log)信息
 
提示:
Activity Monitor默認配置了在Timeline面板中顯示的內(nèi)容,包括TotalVMSizeCPUTotalLoadCPUUserLoadCPUSystemLoad,在使用時可以根據(jù)自己的需要選擇相關(guān)的分析內(nèi)容進行顯示,并且不同的內(nèi)存使用部分可以使用不同的顏色加以區(qū)分,下面就是Activity Monitor在使用過程中的界面截圖,在右下角可選擇內(nèi)存相關(guān)的分析內(nèi)容。

 

下面我們將根據(jù)需要,對Activity Monitor監(jiān)控的內(nèi)容進行分類介紹:
  
二、Activity Monitor監(jiān)控內(nèi)存使用情況

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監(jiān)控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監(jiān)控網(wǎng)絡(luò)情況 

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 itunder “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

 

 
 
 
參考以下文章:

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 丰原市| 洛扎县| 基隆市| 永昌县| 威信县| 博野县| 武城县| 禹州市| 凤冈县| 稻城县| 大英县| 新兴县| 龙游县| 靖州| 安吉县| 宣化县| 融水| 建阳市| 龙陵县| 阿拉善左旗| 建平县| 兴国县| 西安市| 平山县| 乌拉特前旗| 南康市| 牙克石市| 八宿县| 育儿| 饶河县| 怀化市| 青铜峡市| 新余市| 兴宁市| 平昌县| 合作市| 瑞金市| 两当县| 邯郸市| 吕梁市| 南乐县|