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 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 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 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 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 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 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 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 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 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 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 """ if self._coex_mgr_version == 2 and self._config == "channels": SysDebug.stats(self, start, stop) domain = self._domains xmltree = etree.Element("SafeRange%s" % domain) match_log = "" domain_low = self._domains.lower() for cur_log in reversed(self._sys_debug_infos): if "%s_safe_range_min" % domain_low in cur_log.keys(): xmlrange = etree.Element("SafeRange") lsr = LteSafeRanges() if self._config == "channels": xmlrange.attrib["min"] = str( lsr.get_safe_ble_channel_from_freq( int(cur_log["%s_safe_range_min" % domain_low]), "min")) xmlrange.attrib["max"] = str( lsr.get_safe_ble_channel_from_freq( int(cur_log["%s_safe_range_max" % domain_low]), "max")) xmltree.append(xmlrange) match_log = cur_log break self._logger.debug("SafeRange%s stats : %s" % (domain, str(match_log))) return xmltree else: return SafeRangeBase.stats(self, start, stop)
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("Dstates") for item in self._sys_debug_infos: ds = etree.Element("device") ds.attrib["line"] = item xmltree.append(ds) return xmltree
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("Pytimechart") for item in self._sys_debug_infos: if "adb pull" in item: match = re.search("(?P<file>/[^ ]*)", item) if match: cap = etree.Element("capture") capt_file = match.group("file") cap.attrib["file"] = capt_file xmltree.append(cap) folder = "Pytimechart" report_dir = self._device.get_report_tree() report_dir.create_subfolder(folder) report_base = report_dir.get_subfolder_path(folder) local_filename = report_base + "/" + capt_file self._exec("adb shell sync", force_execution=True, wait_for_response=True) self._device.pull(capt_file, local_filename, timeout=180) self._logger.debug("pytimechart_capture pulled: %s" % capt_file) return xmltree
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("Interrupts") irqnum = {} for item in self._infos_before: irqnum[item["name"]] = 0 for i in item["numbers"].split(): irqnum[item["name"]] -= int(i) for item in self._sys_debug_infos: irq = etree.Element("interrupt") irq.attrib["irq"] = item["name"] if item["name"] not in irqnum: irqnum[item["name"]] = 0 for i in item["numbers"].split(): irqnum[item["name"]] += int(i) irq.attrib["number"] = str(irqnum[item["name"]]) irq.attrib["info"] = ' '.join(item["information"].split()) if irqnum[item["name"]]: xmltree.append(irq) 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) xmltree = etree.Element("thermals") for name, value in self._sys_debug_infos.items(): thermal = etree.Element("thermal") thermal.attrib["name"] = name thermal.attrib["value"] = value xmltree.append(thermal) self._logger.debug("Thermal stats : %s" % str(self._sys_debug_infos)) return xmltree
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 """ if self._coex_mgr_version == 1: if self._config == "frequencies": return SafeRangeBase.stats(self, start, stop) else: 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") # Look for the 1st matching channel frequency # Central freq = min freq + 20 (bandwitdh) / 2 lsr = LteSafeRanges() min_freq = int(cur_log["%s_safe_range_min" % domain.lower()]) xmlrange.attrib[ "min"] = lsr.get_safe_wifi_channel_from_freq( min_freq, "min") max_freq = int(cur_log["%s_safe_range_max" % domain.lower()]) xmlrange.attrib[ "max"] = lsr.get_safe_wifi_channel_from_freq( max_freq, "max") xmltree.append(xmlrange) match_log = cur_log break self._logger.debug("SafeRange%s stats : %s" % (domain, str(match_log))) return xmltree elif self._coex_mgr_version == 2: 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 "wifi_prios" in cur_log.keys(): xmlrange = etree.Element("SafeRange") """ Here we need to parse the safe channel bitmap to find the safe range """ cur_prios = cur_log["wifi_prios"] cur_prios = cur_prios.replace(' ', '') cur_prios = cur_prios.split(',') min_safe_value = 1 max_safe_value = cur_prios for i in range(1, len(cur_prios) + 1): if cur_prios[i - 1] != "0": min_safe_value = str(i) break for i in reversed(range(1, len(cur_prios) + 1)): if cur_prios[i - 1] != "0": max_safe_value = str(i) break if self._config == "channels": xmlrange.attrib["min"] = min_safe_value xmlrange.attrib["max"] = max_safe_value else: xmlrange.attrib[ "min"] = AcsWifiFrequencies.get_frequency( int(min_safe_value)) xmlrange.attrib[ "max"] = AcsWifiFrequencies.get_frequency( int(max_safe_value)) xmltree.append(xmlrange) match_log = cur_log break self._logger.debug("SafeRange%s stats : %s" % (domain, str(match_log))) return xmltree