def stats(self, start, stop): """ Return stats :type start: Integer :param start: not used :type stop: Integer :param stop: not used :rtype: etree.Element :return: The Xml tree vue of statistic results of the module """ SysDebug.stats(self, start, stop) xmltree = etree.Element("TimerStats") total_time = stop - start # in seconds for item in self._sys_debug_infos: if "D" in item["deferred"]: continue if int(item["number"]) > total_time * self._min_per_sec: timer = etree.Element("timer") timer.attrib["number"] = item["number"] timer.attrib["pid"] = item["pid"] timer.attrib["process"] = item["pname"] timer.attrib["function"] = item["function"] timer.attrib["timer"] = item["timer"] xmltree.append(timer) return xmltree
def stats(self, start, stop): """ Return representation of lss changes :type start: Integer :param start: The timestamp of the beginning of the measure :type stop: Integer :param stop: The timestamp of the end of the measure :rtype: etree.Element :return: The Xml tree vue of statistic results of the module """ SysDebug.stats(self, start, stop) self._logger.debug("sysDebugInfo = %s" % self._sys_debug_infos) pmustats = {} for sstate in self._sys_debug_infos: pmustats[sstate] = {} for lss in self._sys_debug_infos[sstate]: if lss not in self.__lss_table: self._logger.error("Unable to retrieve LSS Subsystem (%s)" % lss) lss_subsys = self.__lss_table[lss] stats = self.__compute_lss_stats(self._sys_debug_infos[sstate][lss]) pmustats[sstate][lss_subsys] = stats self._logger.debug("Stats : %s" % str(pmustats)) return self.__toxml(pmustats)
def stats(self, start, stop): """ Return wakelocks statistics which have been triggered between start and stop. :type start: Integer :param start: The timestamp of the beginning of the measure :type stop: Integer :param stop: The timestamp of the end of the measure :rtype: etree.Element :return: The Xml tree vue of statistic results of the module """ SysDebug.stats(self, start, stop) xmltree = etree.Element("Residencies") for item in self._sys_debug_infos: residency = etree.Element("Residency") residency.attrib["mode"] = item["mode"].lower() residency.attrib["wakup_count"] = str(item.get("count", "")) residency.attrib["sleep_time"] = str(item.get("time", "")) residency.attrib["residency"] = str(item.get("residency", "")) xmltree.append(residency) self._logger.debug("Residency stats : %s" % str(self._sys_debug_infos)) return xmltree
def init(self): """ Initialization """ SysDebug.init(self) # if not defined if not self.__socwatch_path: return False # install socwatch and run install_script = "" if "Windows" in self._os: self._logger.debug("OS found : Windows") install_script = "socwatch_android_install.bat" elif "Linux" in self._os: self._logger.debug("OS found : Linux") install_script = "socwatch_android_install.sh" else: self._logger.debug("Unknown OS : %s, exiting", self._os) return False cmd = os.path.abspath("%s/%s" % (self.__socwatch_path, install_script)) self._logger.debug("Running %s to install socwatch" % cmd) os.system(cmd) self.load_socwatch_modules() return True
def stats(self, start, stop): """ Return wakelocks statistics which have been triggered between start and stop. :type start: Integer :param start: The timestamp of the beginning of the measure :type stop: Integer :param stop: The timestamp of the end of the measure :rtype: etree.Element :return: The Xml tree vue of statistic results of the module """ SysDebug.stats(self, start, stop) xmltree = etree.Element("ModemPanics") for panic in self._sys_debug_infos: xmlpanic = etree.Element("mpanic") xmlpanic.attrib["errno"] = panic["mpanic_errno"] xmltree.append(xmlpanic) self._logger.debug("modem panic stats : %s" % str(self._sys_debug_infos)) return xmltree
def stats(self, start, stop): """ Return wakelocks statistics which have been triggered between start_trigger and stop_trigger. :type start: Integer :param start: The timestamp of the beginning of the measure :type stop: Integer :param stop: The timestamp of the end of the measure :rtype: etree.Element :return: The Xml tree vue of statistic results of the module """ SysDebug.stats(self, start, stop) sys_debug_infos = self.__sort() self.__get_origin_timestamp() for wakelock in sys_debug_infos: self.__init_tag(wakelock) self.__trig_action(wakelock) self.__compute_spent_time(start, stop) self.__update_spent_time(start, stop) self._logger.debug("wakelocks stats : %s" % self.__wakelocks_stats) return self.__toxml()
def stats(self, start, stop): """ Return safe range statistics which have been triggered between start and stop. :type start: Integer :param start: The timestamp of the beginning of the measure :type stop: Integer :param stop: The timestamp of the end of the measure :rtype: etree.Element :return: The Xml tree view of statistic results of the module """ SysDebug.stats(self, start, stop) xmltree = etree.Element("WifiSoftApChannel") match_log = "" for cur_log in reversed(self._sys_debug_infos): if "soft_ap_channel" in cur_log.keys(): xmltree.attrib["value"] = cur_log["soft_ap_channel"] match_log = cur_log break self._logger.debug("WifiSoftApChannel stats : %s" % (str(match_log))) return xmltree
def __init__(self, device, _config=None): """ Constructor. :type device: Device :param device: The DUT :type config: dictionary :param config: Configuration of the module. Unused for this module """ SysDebug.__init__(self, device) self._retrieve_aplog_command = "grep -h WAKELOCK" # Trigger group : # Key is the name of the group # Value is a list of [group, prefix, pattern, suffix] where pattern # will be fetched in groups by re.search self._trigger_group = [[ "action", "WAKELOCK_", "(ACQUIRE)|(RELEASE)", ": " ], ["timestamp", "TIMESTAMP=", "[0-9]*", ", "], ["tag", "TAG=", "[^,]*", ", "], ["type", "TYPE=", "[A-Z_]*", " *, "], ["count", "COUNT=", "[0-9]*", ", "], ["pid", "PID=", "[0-9]*", ", "], ["uuid", "UID=", "[0-9]*", ".*$"]] self.__wakelocks_file = None self.__active_since_col = None self.__wakelocks_stats = {} self.__ts_origin = None self.__wl_current = None
def stats(self, start, stop): """ Return safe range statistics which have been triggered between start and stop. :type start: Integer :param start: The timestamp of the beginning of the measure :type stop: Integer :param stop: The timestamp of the end of the measure :rtype: etree.Element :return: The Xml tree view of statistic results of the module """ SysDebug.stats(self, start, stop) domain = self._domains xmltree = etree.Element("SafeRange%s" % domain) match_log = "" for cur_log in reversed(self._sys_debug_infos): if "%s_safe_range_min" % domain.lower() in cur_log.keys(): xmlrange = etree.Element("SafeRange") xmlrange.attrib["min"] = cur_log["%s_safe_range_min" % domain.lower()] xmlrange.attrib["max"] = cur_log["%s_safe_range_max" % domain.lower()] xmltree.append(xmlrange) match_log = cur_log break self._logger.debug("SafeRange%s stats : %s" % (domain, str(match_log))) return xmltree
def stats(self, start, stop): """ Return wakelocks statistics which have been triggered between start and stop. :type start: Integer :param start: The timestamp of the beginning of the measure :type stop: Integer :param stop: The timestamp of the end of the measure :rtype: etree.Element :return: The Xml tree vue of statistic results of the module """ SysDebug.stats(self, start, stop) xmltree = etree.Element("CrashInfo") for item in self._sys_debug_infos: panic = etree.Element("crash") panic.attrib["eventid"] = item["eventid"] panic.attrib["date"] = item["evdate"] panic.attrib["eventname"] = item["eventname"] panic.attrib["type"] = item["type"] panic.attrib["data0"] = item["data0"] panic.attrib["data1"] = item["data1"] panic.attrib["data2"] = item["data2"] xmltree.append(panic) self._logger.debug("crashinfo stats : %s" % str(self._sys_debug_infos)) return xmltree
def __init__(self, device, config=None): """ Constructor. :type device: Device :param device: The DUT :type config: dictionary :param config: Configuration of the module. Unused for this module """ SysDebug.__init__(self, device) self._sys_debug_infos = {} self.__thermals = {} self.__thermal_cpu_path = "/sys/devices/platform/coretemp.0" self.__thermal_soc_file = "soc_temp_input" self.__thermal_core_file_temp = "temp[0-9]*_input" self.__thermal_core_file_label = "temp[0-9]*_label" self.__force_thermal_cooling = False self.__thermal_zones_path = "/sys/devices/virtual/thermal" self.__campaign_config = DeviceManager().get_global_config( ).campaignConfig self.__config = {} if config: self.__config = config if "waitForCoolDown" in self.__campaign_config: self.__force_thermal_cooling = self.__campaign_config.get( "waitForCoolDown").lower() == "true"
def __init__(self, device, config): """ Constructor :type config: dictionary :param config: Configuration of the module. The configurable parameter is the interval of dumps. Example of parameter: {"interval : 30} """ SysDebug.__init__(self, device) self.__stats_interval = 180 self.__dump_nb = 0 self.__lss_table = {} self._retrieve_aplog_command = "sed -n '/----MID_PMU_STATS_LOG_BEGIN----/," \ "/----MID_PMU_STATS_LOG_END----/p'" self._regex_begin += "I\s+KERNEL\s*:\s*\[[\s\.\d,]*\]\s+" self.__seconds_before_next_dump = 0 self.__init_sync_ts = 0 self.__sysinfo = None if config and "interval" in config and config["interval"].isdigit(): self.__stats_interval = int(config["interval"]) self._logger.debug("Update pmu_stats_interval to %d" % self.__stats_interval) else: self._logger.debug("No change : config : %s" % str(config))
def init(self): """ Initialisation of module: Get the last id of crashinfo """ SysDebug.init(self) self.__event_number = self.__get_nb_events() return True
def init(self): """ Initialization """ SysDebug.init(self) # if not defined if not self.__dyndebug_keywords: return False return True
def init(self): """ Initialization """ SysDebug.init(self) self.__wakelocks_file = "/sys/kernel/debug/wakeup_sources" self.__active_since_col = 6 return True
def init(self): """ Initialization """ SysDebug.init(self) cmd = "which %s 1> /dev/null 2>&1 && echo Ok || echo NOk" % self.__pytimechart_cmd testfiles = self._exec("adb shell %s" % cmd, 1, force_execution=True) if testfiles == "NOk": return False return True
def __init__(self, device, _config=None): """ Constructor. :type device: DeviceBase :param device: The DUT """ SysDebug.__init__(self, device) self.__residencies_api = self._device.get_uecmd("Residencies") self._use_aplog = False
def __init__(self, device, _config=None): """ Constructor. :type config: dictionary :param config: Configuration of the module. Unused for this module """ SysDebug.__init__(self, device) self.__pytimechart_cmd = "pytimechart-record" self._use_aplog = False
def init(self): """ Initialization """ SysDebug.init(self) cmd = "ls %s 1> /dev/null 2>&1 && echo Ok || echo NOk" % self.__interrupts_file testfiles = self._exec("adb shell %s" % cmd, 1, force_execution=True) if testfiles == "NOk": return False return True
def __init__(self, device, _config=None): """ Constructor. :type config: dictionary :param config: Configuration of the module. Unused for this module """ SysDebug.__init__(self, device) self._sleep_mode_apis = self._device.get_uecmd("SleepMode") self.__d_states_files = self._sleep_mode_apis.get_d_states_files() self._use_aplog = False self._print_debug = False
def init(self): """ Initialization """ SysDebug.init(self) if not self.__d_states_files: self._logger.debug( "Debug file does not exist, Dstates module should not be loaded" ) return False return True
def __init__(self, device, _config=None): """ Constructor. :type config: dictionary :param config: Configuration of the module. Unused for this module """ SysDebug.__init__(self, device) self._retrieve_aplog_regexps.append("mdm_ctrl: CORE_DUMP") self._trigger_group = [[ "mpanic_errno", "KERNEL *: *\[[ \d\.]*\] mdm_ctrl: CORE_DUMP", ".*", "$" ]]
def __init__(self, device, _config=None): """ Constructor. :type config: dictionary :param config: Configuration of the module. Unused for this module """ SysDebug.__init__(self, device) self._retrieve_aplog_regexps.append("failed to suspend") # Trigger group : # Key is the name of the group # Value is a list of [group, prefix, pattern, suffix] where pattern # will be fetched in groups by re.search self._trigger_group = [["device", ".*PM\s:\sDevice ", ".*", " failed to suspend.*:"], ["reason", " ", ".*", "$"]]
def __init__(self, device, _config=None): """ Constructor. :type config: dictionary :param config: Configuration of the module. Unused for this module """ SysDebug.__init__(self, device) self._retrieve_aplog_regexps.append("akeup from") # Trigger group : # Key is the name of the group # Value is a list of [group, prefix, pattern, suffix] where pattern # will be fetched in groups by re.search self._trigger_group = [["irq", ".*akeup\s*from\s*IRQ\s*", "[0-9]+", "\s*"], ["name", "\s*", ".*", "$"]]
def __init__(self, device, _config=None): """ Constructor. :type config: dictionary :param config: Configuration of the module. Unused for this module """ SysDebug.__init__(self, device) self.__interrupts_file = "/proc/interrupts" # May change for some devices self._use_aplog = False self._trigger_group = [["name", "\s*", "[0-9A-Za-z]*", ":"], ["numbers", "\s*", "([0-9]*\s*)*", "\s*"], ["information", "\s*", "[A-Za-z].*", "$"]] self._infos_before = [] self._print_debug = False
def stats(self, start, stop): """ Return stats :type start: Integer :param start: not used :type stop: Integer :param stop: not used :rtype: etree.Element :return: The Xml tree vue of statistic results of the module """ SysDebug.stats(self, start, stop) capt_file = "" xmltree = etree.Element("Socwatch") # Create a tgz with socwatch logs and generate a .tgz device_file = "%s/%s" % (self.__socwatch_folder, self.__socwatch_zip) cmd = "find %s -name '*.csv' -o -name '*.sw1'" % self.__socwatch_folder cmd += "| xargs tar -czf %s" % device_file self._device.run_cmd("adb shell %s" % cmd, self._uecmd_default_timeout, force_execution=True, silent_mode=True) cmd = "ls %s 1> /dev/null 2>&1 && echo Ok || echo NOk" % device_file testfiles = self._exec("adb shell %s" % cmd, 1, force_execution=True) if testfiles == "Ok": folder = "SocWatch" report_dir = self._device.get_report_tree() report_dir.create_subfolder(folder) report_base = report_dir.get_subfolder_path(folder) local_file = report_base + "/socwatch_capture_%s.tgz" % time.strftime( "%Y_%m_%d__%H_%M_%S") self._device.pull(device_file, local_file, timeout=180) self._device.run_cmd("adb shell rm %s" % device_file, self._uecmd_default_timeout, force_execution=True, silent_mode=True) self._logger.debug("socwatch file pulled : %s" % local_file) capt = etree.Element("capture") capt.attrib["file"] = local_file xmltree.append(capt) return xmltree
def __init__(self, device, config=None): """ Constructor. :type config: dict :param config: Defines what this instance will return: Use 'frequencies' to have the safe frequencies range or 'channels' for the frequencies converted in channels. """ SysDebug.__init__(self, device) self._trigger_group = [[ "soft_ap_channel", ".*Wi-Fi Tethering running on channel ", "\d+", "$" ]] self._aplog_level = "I" self._retrieve_aplog_regexps.append( "CWS_CELLCOEX_.*Wi-Fi Tethering running on channel")
def __init__(self, device, _config=None): """ Constructor. :type config: dictionary :param config: Configuration of the module. Unused for this module """ SysDebug.__init__(self, device) self._print_debug = False self._use_aplog = True self._retrieve_aplog_regexps.append("lowmemorykiller: Killing") # Trigger group : # Key is the name of the group # Value is a list of [group, prefix, pattern, suffix] where pattern # will be fetched in groups by re.search self._trigger_group = [[ "process", ".*lowmemorykiller: Killing '", "[^']+", "'.*" ], ["eol", "\s*", ".*", "$"]]
def stats(self, start, stop): """ Return wakelocks statistics which have been triggered between start_trigger and stop_trigger. :type start: Integer :param start: The timestamp of the beginning of the measure :type stop: Integer :param stop: The timestamp of the end of the measure :rtype: etree.Element :return: The Xml tree vue of statistic results of the module """ SysDebug.stats(self, start, stop) self._logger.debug("S3Failure stats : %s" % self._sys_debug_infos) return self.__toxml(self._sys_debug_infos)
def __init__(self, device, config=None): """ Constructor. :type config: dictionary :param config: Configuration of the module. Unused for this module """ SysDebug.__init__(self, device) self._use_aplog = False self._print_debug = False self.__timer_stats_file = "/proc/timer_stats" self._min_per_sec = 20 # only show timers seen at least 10 times per second self._trigger_group = [["number", "\s*", "\d+", ""], ["deferred", "", "[D]?", "\s*,\s*"], ["pid", "\s*", "[0-9]+", "\s*"], ["pname", "\s*", ".*", "\s*"], ["function", "\s+", "[A-Za-z0-9_]+", "\s+"], ["timer", "\s*\(", "[A-Za-z0-9_]+", "\).*$"]]