當前位置:編程學習大全網 - 源碼下載 - 如何使用monitory ios

如何使用monitory ios

Monitor,解釋為:(活動監視器)即實時顯示CPU、內存和網絡的使用情況,記錄由虛擬內存大小測量的系統負載。用壹句大白話來說,Activity Monitor類似Windows中的任務管理器,可以實時查看進程占用的CPU、內存的使用量。

壹. Monitor的介紹和大致使用具體操作步驟,首先從Xcode中運行Instruments,在頂部的菜單欄中,選擇Product,選擇Profile(快捷鍵:Command + I)。會調用Instruments,選擇Activity Monitor 模板

二.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——虛擬內存的占用量?

(1)Console,即控制臺輸出的日誌(Log)信息

提示: Monitor默認配置了在Timeline面板中顯示的內容,包括TotalVMSize、CPUTotalLoad、CPUUserLoad、CPUSystemLoad,在使用時可以根據需要選擇相關的分析內容進行顯示,並且不同的內存使用部分可以使用不同的顏色加以區分,下面就是Activity Monitor在使用過程中的界面截圖,在右下角可選擇內存相關的分析內容。

面我們將根據需要,對Activity Monitor監控的內容進行分類介紹:?二、 Monitor監控內存使用情況

(2)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 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

  • 上一篇:請幫忙編寫壹個通達信選股公式:今天的收盤價大於N日內最高收盤價
  • 下一篇:智能手機,功能手機的定義
  • copyright 2024編程學習大全網