原文:
New Gingerbread API: StrictMode , posted by Brad Fitzpatrick, an Android Software Engineer who worries unreasonably about responsiveness.
先说作者,刚开始还没太注意,写这篇帖子时点开它的博客后发现了这个:http://www.danga.com/,有兴趣的童鞋可以去看看这个公司的开源软件(搞web的会有惊喜哦)。他是danga的创始人。
StrictMode是用于监测访问disk或者network时的低响应和ANR的,是一个development tool.
它的用法和具体细节详看api doc和这篇文章,碰到问题呢,可以去StackOverFlow的strictmode去查或问。
我对文章有下面几点理解和总结:
1.与monkey类似,StrictMode也是用于保障app质量的一个给力工具,前者更倾向于系统的稳健,后者呢更专注软件的性能
2.作者给出一个实例(文中Our Experience那一段)。大概意思就是他们自己搞了一个dogfood的玩意供整个team使用,使用dogfood之后,StrickMode会被开启,并且在Gingerbread开发过程中出现的那些violations(就是被StrickMode机制检测到的问题)都会被日志记录下来,然后有一个叫MapReduce的玩意,每小时执行一次,它会把这些log生成成一份interactive report(就是人看起来比较舒服的报告)。(原文:Every hour a MapReduce job runs and produces an interactive report of all the event loop stalls, their stack traces (including cross-process ones), their latency percentiles, which processes/packages they appear in, etc.)
据作者说,用这些从StrictMode得到的数据,整个google android解决了好几百响应不能的bug和动画问题(哇塞,听起来很诱人哪)。(原文:Using the data from StrictMode we fixed hundreds of responsiveness bugs and animation glitches all across the board. We made performance optimizations in the Android core (e.g. system services and providers) so all apps on the system will benefit, as well as fixing up tons of app-specific issues (in both AOSP apps and Google apps). Even if you’re using Froyo today, the recent updates to GMail, Google Maps, and YouTube all benefited from StrictMode data collection gathered on Gingerbread devices.)
不过从这个实例看出,想从StrictMode长久受益,前期的投入还是不低的,起码得开发一套dogfood build系统,一个定时报告生成系统MapReduce。这就跟我现在这家公司用的hudson一样,很庞大也很复杂,需要很多人力,但是呢,的确对制造高质量的软件很有帮助(我问了在联想的同学,他们是有这想法,一直没实施起来)。
3.让你的app更smooth(性能表现更好),去Thread, java.util.concurrent.*和 Handler, AsyncTask, AsyncQueryHandler, IntentService 这些类里面找办法。
4.HoneyComb将会有一项新机制:当你在main thread(也叫ui thread)里面进行network操作时,会报错。但是之前的sdk还没有这样的机制。
5.我们知道,android的disk用的类似ssd的flash(或者就是),这东东很快吧,但是快归快,你任何牛掰的disk没有file system总不能用吧。android设备上大多用的文件系统是一个叫
YAFFS的玩意,这玩意有一个全局锁(global lock),所有的操作都可能使用这个锁,那么可想而知,某一刻这锁被别人占了,那你的disk操作就可能被等待了。
还是看原文:
You can’t depend on the flash components or filesystems used in most Android devices to be consistently fast. The YAFFS filesystem used on many Android devices, for instance, has a global lock around all its operations. Only one disk operation can be in-flight across the entire device. Even a simple “stat” operation can take quite a while if you are unlucky. Other devices with more traditional block device-based filesystems still occasionally suffer when the block rotation layer decides to garbage collect and do some slow internal flash erase operations. (For some good geeky background reading, see lwn.net/Articles/353411)
6.嗯,没了。:)
ps:鉴于主站被和谐,我把原文下载一份贴上来。。
分享到:
相关推荐
ACME姜饼工具包以圣诞节/冬季主题艺术的各种纹理进行折衷,从而可以构造姜饼结构,带有爆米花线的巨型圣诞树和条纹糖果结构块。 它与ACME Resource Pack结合使用。
android-2.3.3-gingerbread-src.zip
传感器
android_gingerbread_javasrc$001$zip.wslandroid_gingerbread_javasrc$001$zip.wslandroid_gingerbread_javasrc$001$zip.wslandroid_gingerbread_javasrc$001$zip.wsl
android_gingerbread_javasrc$002$zip.wslandroid_gingerbread_javasrc$002$zip.wslandroid_gingerbread_javasrc$002$zip.wsl
合并成 android_gingerbread_javasrc.zip.bat合并成 android_gingerbread_javasrc.zip.bat合并成 android_gingerbread_javasrc.zip.bat
ZTE_U880_Gingerbread_升级工具V2 中兴U880官方刷机工具,新版本,无时间限制
Fresco 是强大的 Android 应用图片显示系统。Fresco 关注图片的加载和显示,可以从网络,本地存储或者本地资源加载图片,显示一个占位符知道图片加载...Fresco 支持 Android 2.3 (Gingerbread) 标签:Facebook
1.6 编译在N1 上运行的android 2.3(GingerBread)代码... .18 1.7 系统结构... ..21 1.8 模拟器调试与真机调试... ..22 1.9 安装和卸载应用程序(apk包) ... ...23 1.10 系统升级... ..26 1.11 android系统支持app2...
最初,将Android Gingerbread相机源进行了分叉,然后进行了修改,使其向下兼容到API级别7(Eclair)。 视频功能也已删除。 然后,对该代码进行了进一步修改,以支持以下无法正常运行的设备: HTC Evo HTC Desire...
VLC-Android 库 libiomx-gingerbread.so libiomx-hc.so libiomx-ics.so libvlcjni.so 直接加载使用就好了。省去你自己编译的麻烦。
GT-I8160_UM_Open_HongKong_Gingerbread_Chi_Rev.1.0_120420_Screen
1.6 编译在N1上运行的android 2.3(GingerBread)代码 18 1.7 系统结构 21 1.8 模拟器调试与真机调试 22 1.9 安装和卸载应用程序(apk包) 23 1.10 系统升级 26 1.11 android系统支持app2sd(修改boot.img) 27 2 基本...
EasyViewPagerUI_v1.2_Beta2 EasyViewPagerUI v1.2 Beta 2版本EasyViewPagerUI版本:v1.2 Beta 2 内部版本号:EasyVPui_v1.2_Beta2_Setting_Transisi_GB + _20150825 建立日期:2015年8月25日经过测试:GingerBread,...
这是一款基于Gingerbread Android OS的双模式iDEN / UMTS手机。
关于如何把ot990的2.2.2的安卓系统刷为2.3.4的系统,本人亲自测试,没有问题,驱动需要下载
NULL 博文链接:https://hualang.iteye.com/blog/1132207
Pro Android 4 shows you how to build real-world and fun mobile apps using the new Android SDK 4 (Ice Cream Sandwich), which unifies Gingerbread for smartphones, Honeycomb for tablets and augments ...