mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
devlib/trace: Refactor trace
to be collector
We now have have multiple `trace` instruments that do not match the description and therefore are moved to have a more suitably named hierarchy.
This commit is contained in:
parent
baa7ad1650
commit
19887de71e
@ -45,10 +45,10 @@ from devlib.derived import DerivedMeasurements, DerivedMetric
|
|||||||
from devlib.derived.energy import DerivedEnergyMeasurements
|
from devlib.derived.energy import DerivedEnergyMeasurements
|
||||||
from devlib.derived.fps import DerivedGfxInfoStats, DerivedSurfaceFlingerStats
|
from devlib.derived.fps import DerivedGfxInfoStats, DerivedSurfaceFlingerStats
|
||||||
|
|
||||||
from devlib.trace.ftrace import FtraceCollector
|
from devlib.collector.ftrace import FtraceCollector
|
||||||
from devlib.trace.perf import PerfCollector
|
from devlib.collector.perf import PerfCollector
|
||||||
from devlib.trace.serial_trace import SerialTraceCollector
|
from devlib.collector.serial_trace import SerialTraceCollector
|
||||||
from devlib.trace.dmesg import DmesgCollector
|
from devlib.collector.dmesg import DmesgCollector
|
||||||
|
|
||||||
from devlib.host import LocalConnection
|
from devlib.host import LocalConnection
|
||||||
from devlib.utils.android import AdbConnection
|
from devlib.utils.android import AdbConnection
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
class TraceCollector(object):
|
class CollectorBase(object):
|
||||||
|
|
||||||
def __init__(self, target):
|
def __init__(self, target):
|
||||||
self.target = target
|
self.target = target
|
@ -18,7 +18,7 @@ import re
|
|||||||
from itertools import takewhile
|
from itertools import takewhile
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
from devlib.trace import TraceCollector
|
from devlib.collector import CollectorBase
|
||||||
|
|
||||||
|
|
||||||
class KernelLogEntry(object):
|
class KernelLogEntry(object):
|
||||||
@ -121,7 +121,7 @@ class KernelLogEntry(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class DmesgCollector(TraceCollector):
|
class DmesgCollector(CollectorBase):
|
||||||
"""
|
"""
|
||||||
Dmesg output collector.
|
Dmesg output collector.
|
||||||
|
|
@ -23,7 +23,7 @@ import sys
|
|||||||
import contextlib
|
import contextlib
|
||||||
from pipes import quote
|
from pipes import quote
|
||||||
|
|
||||||
from devlib.trace import TraceCollector
|
from devlib.collector import CollectorBase
|
||||||
from devlib.host import PACKAGE_BIN_DIRECTORY
|
from devlib.host import PACKAGE_BIN_DIRECTORY
|
||||||
from devlib.exception import TargetStableError, HostError
|
from devlib.exception import TargetStableError, HostError
|
||||||
from devlib.utils.misc import check_output, which, memoized
|
from devlib.utils.misc import check_output, which, memoized
|
||||||
@ -50,7 +50,7 @@ TIMEOUT = 180
|
|||||||
CPU_RE = re.compile(r' Function \(CPU([0-9]+)\)')
|
CPU_RE = re.compile(r' Function \(CPU([0-9]+)\)')
|
||||||
STATS_RE = re.compile(r'([^ ]*) +([0-9]+) +([0-9.]+) us +([0-9.]+) us +([0-9.]+) us')
|
STATS_RE = re.compile(r'([^ ]*) +([0-9]+) +([0-9.]+) us +([0-9.]+) us +([0-9.]+) us')
|
||||||
|
|
||||||
class FtraceCollector(TraceCollector):
|
class FtraceCollector(CollectorBase):
|
||||||
|
|
||||||
# pylint: disable=too-many-locals,too-many-branches,too-many-statements
|
# pylint: disable=too-many-locals,too-many-branches,too-many-statements
|
||||||
def __init__(self, target,
|
def __init__(self, target,
|
@ -16,10 +16,10 @@
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from devlib.trace import TraceCollector
|
from devlib.collector import CollectorBase
|
||||||
from devlib.utils.android import LogcatMonitor
|
from devlib.utils.android import LogcatMonitor
|
||||||
|
|
||||||
class LogcatCollector(TraceCollector):
|
class LogcatCollector(CollectorBase):
|
||||||
|
|
||||||
def __init__(self, target, regexps=None):
|
def __init__(self, target, regexps=None):
|
||||||
super(LogcatCollector, self).__init__(target)
|
super(LogcatCollector, self).__init__(target)
|
@ -19,7 +19,7 @@ import time
|
|||||||
from past.builtins import basestring, zip
|
from past.builtins import basestring, zip
|
||||||
|
|
||||||
from devlib.host import PACKAGE_BIN_DIRECTORY
|
from devlib.host import PACKAGE_BIN_DIRECTORY
|
||||||
from devlib.trace import TraceCollector
|
from devlib.collector import CollectorBase
|
||||||
from devlib.utils.misc import ensure_file_directory_exists as _f
|
from devlib.utils.misc import ensure_file_directory_exists as _f
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ SIMPLEPERF_DEFAULT_EVENTS = [
|
|||||||
|
|
||||||
DEFAULT_EVENTS = {'perf':PERF_DEFAULT_EVENTS, 'simpleperf':SIMPLEPERF_DEFAULT_EVENTS}
|
DEFAULT_EVENTS = {'perf':PERF_DEFAULT_EVENTS, 'simpleperf':SIMPLEPERF_DEFAULT_EVENTS}
|
||||||
|
|
||||||
class PerfCollector(TraceCollector):
|
class PerfCollector(CollectorBase):
|
||||||
"""
|
"""
|
||||||
Perf is a Linux profiling with performance counters.
|
Perf is a Linux profiling with performance counters.
|
||||||
Simpleperf is an Android profiling tool with performance counters.
|
Simpleperf is an Android profiling tool with performance counters.
|
@ -19,7 +19,7 @@ import sys
|
|||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from devlib.trace import TraceCollector
|
from devlib.collector import BaseCollector
|
||||||
from devlib.exception import WorkerThreadError
|
from devlib.exception import WorkerThreadError
|
||||||
|
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ class ScreenCapturePoller(threading.Thread):
|
|||||||
self.target.capture_screen(os.path.join(self.output_path, "screencap_{ts}.png"))
|
self.target.capture_screen(os.path.join(self.output_path, "screencap_{ts}.png"))
|
||||||
|
|
||||||
|
|
||||||
class ScreenCaptureCollector(TraceCollector):
|
class ScreenCaptureCollector(BaseCollector):
|
||||||
|
|
||||||
def __init__(self, target, output_path=None, period=None):
|
def __init__(self, target, output_path=None, period=None):
|
||||||
super(ScreenCaptureCollector, self).__init__(target)
|
super(ScreenCaptureCollector, self).__init__(target)
|
@ -17,11 +17,11 @@ import shutil
|
|||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
from pexpect.exceptions import TIMEOUT
|
from pexpect.exceptions import TIMEOUT
|
||||||
|
|
||||||
from devlib.trace import TraceCollector
|
from devlib.collector import CollectorBase
|
||||||
from devlib.utils.serial_port import get_connection
|
from devlib.utils.serial_port import get_connection
|
||||||
|
|
||||||
|
|
||||||
class SerialTraceCollector(TraceCollector):
|
class SerialTraceCollector(CollectorBase):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def collecting(self):
|
def collecting(self):
|
@ -20,7 +20,7 @@ from shutil import copyfile
|
|||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
from devlib.exception import TargetStableError, HostError
|
from devlib.exception import TargetStableError, HostError
|
||||||
from devlib.trace import TraceCollector
|
from devlib.collector import CollectorBase
|
||||||
import devlib.utils.android
|
import devlib.utils.android
|
||||||
from devlib.utils.misc import memoized
|
from devlib.utils.misc import memoized
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ DEFAULT_CATEGORIES = [
|
|||||||
'idle'
|
'idle'
|
||||||
]
|
]
|
||||||
|
|
||||||
class SystraceCollector(TraceCollector):
|
class SystraceCollector(CollectorBase):
|
||||||
"""
|
"""
|
||||||
A trace collector based on Systrace
|
A trace collector based on Systrace
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user