Esempio n. 1
0
    def start(self):
        self.file = os.path.join(subst_env_vars(self.args.input), 'atrace-%s.ftrace' % (self.args.cuts[0] if self.args.cuts else '0'))
        self.echo('0', '/sys/kernel/debug/tracing/tracing_on')
        self.echo('', '/sys/kernel/debug/tracing/trace')
        self.echo('1', '/sys/kernel/debug/tracing/events/i915/enable')
        self.echo('1', '/sys/kernel/debug/tracing/events/kgsl/enable')

        if self.is_root():
            out, err = self.execute(self.adb + ' shell atrace --list_categories')
            if err:
                return False
            features = []
            for line in out.split('\n'):
                parts = line.split()
                if not parts:
                    continue
                features.append(parts[0])

            cmd = self.adb + ' shell atrace'
            if self.args.ring:
                cmd += ' -b %d -c' % (self.args.ring * 1000)
            cmd += ' --async_start %s' % ' '.join(features)
            self.execute_detached(cmd)
        else:  # non roots sometimes have broken atrace, so we won't use it
            out, err = self.execute(self.adb + ' shell setprop debug.atrace.tags.enableflags 0xFFFFFFFF')
            if err:
                return None
            for event in self.enum_switchable_events():
                self.echo('1', event)
            if self.args.ring:
                self.echo("%d" % (self.args.ring * 1024), '/sys/kernel/debug/tracing/buffer_size_kb')
            out, err = self.echo('1', '/sys/kernel/debug/tracing/tracing_on')
            if err:
                return None
        return self
Esempio n. 2
0
    def start(self):
        self.file = os.path.join(subst_env_vars(self.args.input), 'atrace-%s.ftrace' % (self.args.cuts[0] if self.args.cuts else '0'))
        self.echo('0', '/sys/kernel/debug/tracing/tracing_on')
        self.echo('', '/sys/kernel/debug/tracing/trace')
        if self.is_root():
            out, err = self.execute(self.adb + ' shell atrace --list_categories')
            if err:
                return False
            features = []
            for line in out.split('\n'):
                parts = line.split()
                if not parts:
                    continue
                features.append(parts[0])

            cmd = self.adb + ' shell atrace'
            if self.args.ring:
                cmd += ' -b %d -c' % (self.args.ring * 1000)
            cmd += ' --async_start %s' % ' '.join(features)
            self.execute_detached(cmd)
        else:  # non roots sometimes have broken atrace, so we won't use it
            out, err = self.execute(self.adb + ' shell setprop debug.atrace.tags.enableflags 0xFFFFFFFF')
            if err:
                return None
            for event in self.enum_switchable_events():
                self.echo('1', event)
            if self.args.ring:
                self.echo("%d" % (self.args.ring * 1024), '/sys/kernel/debug/tracing/buffer_size_kb')
            out, err = self.echo('1', '/sys/kernel/debug/tracing/tracing_on')
            if err:
                return None
        return self
Esempio n. 3
0
def is_domain_enabled(domain, default=True):
    filter = os.environ.get('INTEL_SEA_FILTER')
    if not filter:
        return default
    filter = subst_env_vars(filter)
    with open(filter) as file:
        for line in file:
            enabled = not line.startswith('#')
            if domain == line.strip(' #\n\r'):
                return enabled
    return default
Esempio n. 4
0
def is_domain_enabled(domain, default=True):
    filter = os.environ.get('INTEL_SEA_FILTER')
    if not filter:
        return default
    filter = subst_env_vars(filter)
    with open(filter) as file:
        for line in file:
            enabled = not line.startswith('#')
            if domain == line.strip(' #\n\r'):
                return enabled
    return default