计算机科学与探索 ›› 2018, Vol. 12 ›› Issue (10): 1604-1613.DOI: 10.3778/j.issn.1673-9418.1710024

• 系统软件与软件工程 • 上一篇    下一篇

Android应用异步编程模型性能分析

薛海龙1,2+,陈  渝2,雷  蕾1,王  丹1   

  1. 1. 北京工业大学 计算机学院,北京 100124
    2. 清华大学 计算机学院,北京 100084
  • 出版日期:2018-10-01 发布日期:2018-10-08

Performance Analysis of Asynchronous Programming Model for Android Application

XUE Hailong1,2+, CHEN Yu2, LEI Lei1,WANG Dan1   

  1. 1. College of Computer Science and Technology, Beijing University of Technology, Beijing 100124, China
    2. College of Computer Science and Technology, Tsinghua University, Beijing 100084, China
  • Online:2018-10-01 Published:2018-10-08

摘要: 为保障Android应用程序拥有良好的响应性能,开发人员都会采用异步编程的方式,即将耗时任务放在子线程中去执行。这种方式虽然明显提高了应用程序的性能,但是一旦出现性能问题是很难定位原因的。因此为解决开发人员多采用异步编程方式来提高用户体验而引发的Android系统响应性能低下,程序执行过程复杂性增加的问题,提出一种基于异步跟踪实现Android应用响应性能检测与分析的方法。通过对Android系统的Framework层中关键代码进行插桩,完成对程序异步线程执行过程的跟踪,并构建出跨越异步调用边界的关键路径。最后,通过对关键路径的分析得出影响响应性能的主要原因,并反馈给开发者。通过一些特定的测试用例实验和运用该方法解决OPENTHOS系统上存在的实际问题,结果都表明达到了预期目标。

关键词: Android, 性能分析, Framework, Log, 关键路径

Abstract: To make sure that Android applications have a good responding performance, developers can use asynchronous programming, i.e. time-consuming tasks are placed in the sub-thread. This approach significantly improves the performance of the application, but it is very difficult to locate the reason when something goes wrong. This paper presents a method based on asynchronous tracking to realize the performance detection and analysis of Android application response in order to solve the problem that the Android system response performance is low and the complexity of the program execution process is increased which is caused by asynchronous programming to improve the user experience. Through the key code in the Android system??s framework layer, this paper tracks the asynchronous thread execution process and constructs the critical path across the asynchronous call boundary. Finally, the main reason that affects the response performance is obtained by key path analysis and fed back to the developer. Through a number of specific test cases and the use of this method on solving the problems on OPENTHOS, results show that the desired target is achieved.

Key words: Android, performance analysis, Framework, Log, critical path