如何监控一个Activityjquery 页面加载完毕毕

他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)2010年12月 移动平台大版内专家分月排行榜第二2010年11月 移动平台大版内专家分月排行榜第二
2011年5月 移动平台大版内专家分月排行榜第三2011年4月 移动平台大版内专家分月排行榜第三2011年3月 移动平台大版内专家分月排行榜第三
匿名用户不能发表回复!|&nbsp&#8250&nbsp&nbsp&#8250&nbsp
如何监控一个Activity加载完毕(完成渲染)-onWindowFocusChanged
我也不知道是不是专门用来监控Activity的。但通过这个事件可以实现当一个Activity完全加载完毕后,然后就执行。@Override
public void onWindowFocusChanged(boolean hasFocus) {
// TODO Auto-generated method stub
super.onWindowFocusChanged(hasFocus);
}这个onWindowFocusChanged指的是这个Activity得到或者失去焦点的时候 就会call。。也就是说 如果你想要做一个Activity一加载完毕,就触发什么的话 完全可以用这个!!!有人说可以利用Activity的生命周期。onResume当你的Activity成为屏幕前端Activity后onResume将被立刻调用。在这个时间点你的Activity处于运行状态并且能与用户进行交互。你可以接受键盘和触摸输入,并在屏幕上显示你的用户界面。当你的Activity失去屏幕前端焦点时onResume也会被调用,并且这个Activity最终退出,而另一Activity将被弹到前端。这也是你的Activity将开始(或恢复)的地方,并且可以做一些需要的事情比如更新用户界面(例如:接收位置更新或者运行一个动画)。这==个。?我试过。是无法实现里面控件加载完毕后,取得他们的状态的!android API :void onWindowFocusChanged(boolean hasFocus) Called when the current Window of the activity gains or loses focus.得到焦点是hasFocus == true 反之亦然!API 才是王道!!!
上一篇: 如题:在activity的oncreate方法中使用popupwindow出现以下错误: android.view.WindowManager$BadTokenException: Unable to add window -- tok is your activity running? 错误代码如下 : pop = new PopupWindow(pop_view,320,250);
下一篇: 在游戏的开发过程中必定会涉及到N多图片的处理,比如图片的切割、转动、平移等操作,本篇主要描述使用Canvas对图片的clip动作。 Canvas.clipRect(float left, float top, float right, float bottom, Paint paint)这个方法我们自然很明白了,在手机屏幕上裁如何监控一个Activity加载完毕_百度知道
如何监控一个Activity加载完毕
我有更好的答案
普通人是无法监控的。只有那些有技术的人,通过app或wifi就能监控。
为您推荐:
其他类似问题
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。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面板中显示的内容,包括TotalVMSize、CPUTotalLoad、CPUUserLoad、CPUSystemLoad,在使用时可以根据自己的需要选择相关的分析内容进行显示,并且不同的内存使用部分可以使用不同的颜色加以区分,下面就是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:
CPUTtotalLoadCPUUserLoadCPUSystemLoadCPUNiceLoad
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
参考以下文章:
&转载请注明出处:
阅读(...) 评论()

我要回帖

更多关于 js判断页面加载完毕 的文章

 

随机推荐