Monkeyrunner+powertutor Simple power consumption test

Source: Internet
Author: User

The company this time to conduct competitive performance comparison test, here is the use of Python to write a simple Monnkeyrunner power consumption test demo.


Pre-instructions: Test products can be left and right sliding appear (can be understood as having three interfaces)

Test tool: Eclipse+python plug-in (2.7.0) +powertutor

Steps:

1. First, install Eclipse's Python plugin, which can refer to the following URL:

Http://www.cnblogs.com/sevenyuan/archive/2009/12/10/1620939.html


Here is a bit of advice, because bloggers in the process of installing the plugin has encountered the installation of plug-ins can not be used correctly, you can try the following two ways:

(1) Since the plugin version provided in the download process is not based on the Python version of your system, it is possible that the plugin in eclipse is incompatible with your Python version, so even if you show that the download was successful but not applied, View your Python version (the terminal of the Linux system can be directly entered in Python view);

(2) Download an up-to-date ADT, blogger because the eclipse version is not updated so the installation failed, please learn from;


2. Open eclipse, which already has the Python plugin installed, and create a new Python project (refer to:

http://blog.csdn.net/shandong_chu/article/details/8125420)


3. In the new project can be monkeyrunner to write, the specific code is as follows:

From Com.android.monkeyrunner import monkeyrunnerfrom com.android.monkeyrunner.easy import Easymonkeydevicefrom Com.android.monkeyrunner.easy Import Byfrom Com.android.monkeyrunner Imports monkeydevice# related Monkeyrunner package device= Monkeyrunner.waitforconnection (1.0, ' emulator-5554 ') #连接一个模拟器for I in Range (0,5): The #用一个for in range loop does the following five times DEVICE.D Rag (700,240), (100,240), 1,10) #A界面 Device.drag ((100,240), (700,240), 1,10) #B界面 Device.drag ((100,240), (700,240), 1,10 ) #C界面 #以上device. Drag is a slide operation on the screen, the first two parameters are the starting and ending coordinates on the screen # The operation is a interface (right slide)-->b interface (left slide)-->c interface (left slide)-->a interface


4. After the code is written, save it as a. py file;

5. Before starting the test, first open the Power consumption test tool, here is the use of Powertutor power Tools, click to start;


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/58/76/wKioL1SyOJGyvlVkAAMAepQp1bA335.jpg "title=" Powertutor start Interface "alt=" Wkiol1syojgyvlvkaamaepqp1ba335.jpg "/>


6. Return to the test interface, run the Py file (specific operation method can refer to the blogger's other article);

7. After running, go back to the Powertutor main screen and click Application Viewer to view the power consumption of the test app. From what can be seen, you can observe the app in the case of LCD or not, the different power consumption data;


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/76/wKioL1SyOpWyVAOVAAICgc5GXsY173.jpg "title=" Powertutor the data condition after the test is complete "alt=" Wkiol1syopwyvaovaaicgc5gxsy173.jpg "/>



8. Repeat the above operation 15 times, remove the maximum and minimum values, and then average, get the test data.

Monkeyrunner+powertutor Simple power consumption test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.