def initialize(self, context):
        cmd_options = {}
        if context.device.get_sdk_version() >= 23:
            # Set up command line options
            if self.app_names:
                cmd_options["-a"] = ",".join(self.app_names)
            if self.buffer_size:
                cmd_options["-b"] = self.buffer_size
            if self.use_circular_buffer:
                cmd_options["-c"] = None
            if self.kernel_functions:
                cmd_options["-k"] = ",".join(self.kernel_functions)
            if self.ignore_signals:
                cmd_options["-n"] = None

            # Generate commands
            opt_string = ''.join(['{} {} '.format(name, value or "")
                                  for name, value in cmd_options.iteritems()])
            self.start_cmd = "atrace --async_start {} {}".format(opt_string,
                                                                 " ".join(self.categories))
            self.output_file = os.path.join(self.device.working_directory, "atrace.txt")
            self.stop_cmd = "atrace --async_stop {} > {}".format("-z" if self.compress_trace else "",
                                                                 self.output_file)

            # Check if provided categories are available on the device
            available_categories = [cat.strip().split(" - ")[0] for cat in
                                    context.device.execute("atrace --list_categories").splitlines()]
            for category in self.categories:
                if category not in available_categories:
                    raise ConfigError("Unknown category '{}'; Must be one of: {}"
                                      .format(category, available_categories))
        else:
            raise InstrumentError("Only android devices with an API level >= 23 can use systrace properly")
dataset/ETHPy150Open ARM-software/workload-automation/wlauto/instrumentation/systrace/__init__.py/systrace.initialize/original