def setUp(self): super(DumpsysTests, self).setUp() self.dumpsysMeminfo = Dumpsys.meminfo(self.device, self.sample_process_name) self.dumpsysGfxinfo = Dumpsys.gfxinfo(self.device, self.sample_process_name, Dumpsys.FRAMESTATS)
def test_parseGfxinfoFramestats(self): out = '''\ Something Something Something Something ---PROFILEDATA--- Flags,IntendedVsync,Vsync,OldestInputEvent,NewestInputEvent,HandleInputStart,AnimationStart,PerformTraversalsStart,DrawStart,SyncQueued,SyncStart,IssueDrawCommandsStart,SwapBuffers,FrameCompleted, 0,1538750837982,1539034171304,9223372036854775807,0,1539047401632,1539047424965,1539047516299,1539047541049,1539047873632,1539048042382,1539048073215,1539085917465,1539087148465, 0,1808866542439,1808899875771,9223372036854775807,0,1808909338401,1808909869234,1808911205068,1808911288234,1808911729484,1808911906651,1808912287651,1808920894568,1808922659568, ---PROFILEDATA--- Something Something Something Something Something ---PROFILEDATA--- Flags,IntendedVsync,Vsync,OldestInputEvent,NewestInputEvent,HandleInputStart,AnimationStart,PerformTraversalsStart,DrawStart,SyncQueued,SyncStart,IssueDrawCommandsStart,SwapBuffers,FrameCompleted, 1,1538295812863,1538495812855,9223372036854775807,0,1538506027632,1538506079049,1538506994882,1538517724382,1538550285632,1538550403216,1538550458966,1538559445132,1538561759382, ---PROFILEDATA--- ''' dumpsys = Dumpsys(None, None) dumpsys.parseGfxinfoFramestats(out)
def __plot_dumpsys_meminfo(self, pkg, activity, method=None): self.device.shell("am force-stop %s" % pkg) for n in range(20): if n % 5 == 0: self.device.shell("run-as %s pgrep -L 10 %s" % (pkg, pkg)) self.device.startActivity("%s/%s" % (pkg, activity)) time.sleep(2) if method: method() self.plot.append(Dumpsys(self.device, Dumpsys.MEMINFO, pkg)) self.device.press('BACK') time.sleep(0.5) self.device.press('BACK') time.sleep(0.5) self.device.press('HOME') time.sleep(0.5) self.plot.plot()
def test_listSubCommands(self): self.assertIsNotNone(Dumpsys.listSubCommands(self.device))
def setUp(self): super(DumpsysTests, self).setUp() self.dumpsysMeminfo = Dumpsys.meminfo(self.device, SAMPLE_PROCESS_NAME) self.dumpsysGfxinfo = Dumpsys.gfxinfo(self.device, SAMPLE_PROCESS_NAME, Dumpsys.FRAMESTATS)
#! /usr/bin/env python # -*- coding: utf-8 -*- import re import sys import os try: sys.path.insert( 0, os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src')) except: pass from com.dtmilano.android.viewclient import ViewClient from com.dtmilano.android.adb.dumpsys import Dumpsys from com.dtmilano.android.plot import Plot try: pkg = sys.argv.pop(1) except: sys.exit('usage: %s <package> [serialno]' % sys.argv[0]) device, serialno = ViewClient.connectToDeviceOrExit() Plot().append(Dumpsys(device, Dumpsys.GFXINFO, pkg, Dumpsys.FRAMESTATS)).plot(_type=Dumpsys.FRAMESTATS)
def dumpsys(self, subcommand, args): return Dumpsys(self, subcommand, args)
def __plot_dumpsys_gfxinfo(self, pkg): print('plot dumpsys gfxinfo: {}'.format(pkg), file=sys.stderr) dumpsys = Dumpsys(self.device, Dumpsys.GFXINFO, pkg, Dumpsys.FRAMESTATS) self.plot.append(dumpsys) \ .plot(_type=Dumpsys.FRAMESTATS)
def test_plot_dumpsys_meminfo(self): for n in range(10): self.plot.append( Dumpsys(self.device, Dumpsys.MEMINFO, SAMPLE_PROCESS_NAME)) time.sleep(1) self.plot.plot()
def __plot_dumpsys_gfxinfo(self, pkg): self.plot.append(Dumpsys(self.device, Dumpsys.GFXINFO, pkg, Dumpsys.FRAMESTATS)) self.plot.plot(_type=Dumpsys.FRAMESTATS)