2020-06-16 10:27:17 +00:00
|
|
|
import os
|
2020-03-28 17:22:46 +00:00
|
|
|
import time
|
|
|
|
|
|
|
|
import numpy as np
|
2020-06-16 10:27:17 +00:00
|
|
|
|
|
|
|
# os.chdir('../')
|
|
|
|
print(os.getcwd())
|
2020-05-26 18:42:25 +00:00
|
|
|
import module.config.server as server
|
|
|
|
|
|
|
|
server.server = 'cn' # Don't need to edit, it's used to avoid error.
|
2020-03-28 17:22:46 +00:00
|
|
|
|
|
|
|
from module.config.config import AzurLaneConfig
|
|
|
|
from module.device.device import Device
|
|
|
|
|
|
|
|
|
|
|
|
class EmulatorChecker(Device):
|
|
|
|
def stress_test(self):
|
|
|
|
record = []
|
|
|
|
count = 0
|
|
|
|
self._screenshot_adb()
|
|
|
|
while 1:
|
|
|
|
t0 = time.time()
|
|
|
|
# self._screenshot_adb()
|
2020-06-16 10:27:17 +00:00
|
|
|
# self._screenshot_uiautomator2()
|
|
|
|
self._screenshot_ascreencap()
|
2020-03-28 17:22:46 +00:00
|
|
|
# self._click_adb(1270, 360)
|
|
|
|
# self._click_uiautomator2(1270, 360)
|
|
|
|
|
|
|
|
cost = time.time() - t0
|
|
|
|
record.append(cost)
|
|
|
|
count += 1
|
|
|
|
print(count, np.round(np.mean(record), 3), np.round(np.std(record), 3))
|
|
|
|
|
|
|
|
|
2020-06-16 10:27:17 +00:00
|
|
|
class Config:
|
2020-06-15 23:33:28 +00:00
|
|
|
SERIAL = '127.0.0.1:5555'
|
|
|
|
# SERIAL = '127.0.0.1:62001'
|
2020-03-28 17:22:46 +00:00
|
|
|
# SERIAL = '127.0.0.1:7555'
|
|
|
|
# SERIAL = 'emulator-5554'
|
|
|
|
# SERIAL = '127.0.0.1:21503'
|
|
|
|
|
2020-06-15 23:33:28 +00:00
|
|
|
# Speed: aScreenCap >> uiautomator2 > ADB
|
|
|
|
DEVICE_SCREENSHOT_METHOD = 'aScreenCap' # ADB, uiautomator2, aScreenCap
|
|
|
|
|
|
|
|
# Speed: uiautomator2 >> ADB
|
|
|
|
DEVICE_CONTROL_METHOD = 'uiautomator2' # ADB, uiautomator2
|
2020-03-28 17:22:46 +00:00
|
|
|
|
|
|
|
|
2020-05-26 18:42:25 +00:00
|
|
|
az = EmulatorChecker(AzurLaneConfig('template').merge(Config()))
|
2020-03-28 17:22:46 +00:00
|
|
|
az.stress_test()
|