mirror of
https://github.com/ARM-software/devlib.git
synced 2025-04-10 20:00:03 +01:00
instrument/frames: Add surfaceflinger frames instrument
Add an instrument that utilizes the SurfaceFringerFrameCollector.
This commit is contained in:
parent
2b3cee6a7e
commit
1d3b4c8062
@ -1,16 +1,19 @@
|
|||||||
from devlib.instrument import (Instrument, CONTINUOUS,
|
from devlib.instrument import (Instrument, CONTINUOUS,
|
||||||
MeasurementsCsv, MeasurementType)
|
MeasurementsCsv, MeasurementType)
|
||||||
from devlib.utils.rendering import (GfxinfoFrameCollector,
|
from devlib.utils.rendering import (GfxinfoFrameCollector,
|
||||||
|
SurfaceFlingerFrameCollector,
|
||||||
|
SurfaceFlingerFrame,
|
||||||
read_gfxinfo_columns)
|
read_gfxinfo_columns)
|
||||||
|
|
||||||
|
|
||||||
class GfxInfoFramesInstrument(Instrument):
|
class FramesInstrument(Instrument):
|
||||||
|
|
||||||
mode = CONTINUOUS
|
mode = CONTINUOUS
|
||||||
|
collector_cls = None
|
||||||
|
|
||||||
def __init__(self, target, package, period=2, keep_raw=True):
|
def __init__(self, target, collector_target, period=2, keep_raw=True):
|
||||||
super(GfxInfoFramesInstrument, self).__init__(target)
|
super(FramesInstrument, self).__init__(target)
|
||||||
self.package = package
|
self.collector_target = collector_target
|
||||||
self.period = period
|
self.period = period
|
||||||
self.keep_raw = keep_raw
|
self.keep_raw = keep_raw
|
||||||
self.collector = None
|
self.collector = None
|
||||||
@ -19,9 +22,9 @@ class GfxInfoFramesInstrument(Instrument):
|
|||||||
self._init_channels()
|
self._init_channels()
|
||||||
|
|
||||||
def reset(self, sites=None, kinds=None, channels=None):
|
def reset(self, sites=None, kinds=None, channels=None):
|
||||||
super(GfxInfoFramesInstrument, self).reset(sites, kinds, channels)
|
super(FramesInstrument, self).reset(sites, kinds, channels)
|
||||||
self.collector = GfxinfoFrameCollector(self.target, self.period,
|
self.collector = self.collector_cls(self.target, self.period,
|
||||||
self.package, self.header)
|
self.collector_target, self.header)
|
||||||
self._need_reset = False
|
self._need_reset = False
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
@ -42,6 +45,15 @@ class GfxInfoFramesInstrument(Instrument):
|
|||||||
self.collector.write_frames(outfile, columns=active_sites)
|
self.collector.write_frames(outfile, columns=active_sites)
|
||||||
return MeasurementsCsv(outfile, self.active_channels)
|
return MeasurementsCsv(outfile, self.active_channels)
|
||||||
|
|
||||||
|
def _init_channels(self):
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
||||||
|
class GfxInfoFramesInstrument(FramesInstrument):
|
||||||
|
|
||||||
|
mode = CONTINUOUS
|
||||||
|
collector_cls = GfxinfoFrameCollector
|
||||||
|
|
||||||
def _init_channels(self):
|
def _init_channels(self):
|
||||||
columns = read_gfxinfo_columns(self.target)
|
columns = read_gfxinfo_columns(self.target)
|
||||||
for entry in columns:
|
for entry in columns:
|
||||||
@ -51,3 +63,14 @@ class GfxInfoFramesInstrument(Instrument):
|
|||||||
self.add_channel(entry, 'time_us')
|
self.add_channel(entry, 'time_us')
|
||||||
self.header = [chan.label for chan in self.channels.values()]
|
self.header = [chan.label for chan in self.channels.values()]
|
||||||
|
|
||||||
|
|
||||||
|
class SurfaceFlingerFramesInstrument(FramesInstrument):
|
||||||
|
|
||||||
|
mode = CONTINUOUS
|
||||||
|
collector_cls = SurfaceFlingerFrameCollector
|
||||||
|
|
||||||
|
def _init_channels(self):
|
||||||
|
for field in SurfaceFlingerFrame._fields:
|
||||||
|
# remove the "_time" from filed names to avoid duplication
|
||||||
|
self.add_channel(field[:-5], 'time_us')
|
||||||
|
self.header = [chan.label for chan in self.channels.values()]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user