def __get_text(self, colorize=False): summary = "" if ((not self.__gs_glocks_total_lowest == None) or (not self.__gs_glocks_total_highest == None)): glocks_stats_totals_table = self.__get_glocks_count_table() if (len(glocks_stats_totals_table)): summary += "The lowest and highest total count of glocks in all the snapshots.\n" summary += "%s\n\n" %(tableize(glocks_stats_totals_table, ["Hostname", "Filesystem", "Glock Total Count", "Time Occurred"], colorize=colorize).strip()) for snapshot in self.get_snapshots(): glocks_stats = snapshot.get_glocks_stats() formatted_table = tableize(glocks_stats.get_table(), ["Glock States"] + glocktop_analyze.glocks_stats.GLOCK_STATES, colorize=colorize).rstrip() if (colorize): summary += "Glock stats at %s for filesystem: " %(ColorizeConsoleText.orange( glocks_stats.get_date_time().strftime("%Y-%m-%d %H:%M:%S"))) summary += "%s\n%s\n\n" %(ColorizeConsoleText.orange( self.get_filesystem_name()), formatted_table) else: summary += "Glock stats at %s for filesystem: " %(glocks_stats.get_date_time().strftime("%Y-%m-%d %H:%M:%S")) summary += "%s\n%s\n\n" %(self.get_filesystem_name(), formatted_table) if (summary): return "%s: %s\n\n%s\n" %(self.get_title(), self.get_description(), summary.strip()) return ""
def __get_text(self, colorize=False): # Need to add warning: summary = "" for pidglocks_in_snapshot in self.__glocks_dependencies_snapshots: snapshot_summary = "" # Review all the glocks for a particular pid. for pidglocks in pidglocks_in_snapshot.get_pidglocks(): pid_summary = "" glock_holder_flag_found = 0 glocks = pidglocks.get_glocks() if (len(glocks) >= self.__minimum_glocks_dep): for glock in glocks: pid_summary += " %s\n" %(glock) for h in glock.get_holders(): pid_summary += " %s\n" %(h) glock_object = glock.get_glock_object() if (not glock_object == None): pid_summary += " %s\n" %(glock_object) if (not glock.get_glock_holder() == None): glock_holder_flag_found += 1 if (pid_summary): pid_header = " pid: %s command: %s | " %(pidglocks.get_pid(), pidglocks.get_command()) pid_header += "%d glocks associated with pid " %(len(pidglocks.get_glocks())) pid_header += "(%d glock holders)\n" %(glock_holder_flag_found) if (colorize): pid_header = ColorizeConsoleText.orange(pid_header) snapshot_summary += "%s%s\n" %(pid_header, pid_summary) if (snapshot_summary): snapshot_header = "%s - %s @%s" %(pidglocks_in_snapshot.get_filesystem_name(), pidglocks_in_snapshot.get_date_time(), pidglocks_in_snapshot.get_hostname()) if (colorize): snapshot_header = ColorizeConsoleText.red(snapshot_header) summary += "%s\n%s\n\n" %(snapshot_header, snapshot_summary.strip()) if (summary): summary = "%s: %s\n%s" %(self.get_title(), self.get_description(), summary) return summary