def __generate_graphs_by_glock_state(self, png_format=False): path_to_output_dir = os.path.join(os.path.join(self.get_path_to_output_dir(), self.get_filesystem_name()), "graphs") if (self.get_snapshots()): path_to_image_files = [] snapshot_date_time = [] # This is graphing the states for differnt glock states. X is time, Y is # one of 7 glock types. for gstate in glocktop_analyze.glocks_stats.GLOCK_STATES: glock_types_stats = {} for snapshot in self.get_snapshots(): glocks_stats = snapshot.get_glocks_stats() if (not snapshot.get_date_time() in snapshot_date_time): snapshot_date_time.append(snapshot.get_date_time()) gtypes_stats = glocks_stats.get_stats_by_state(gstate) for key in gtypes_stats.keys(): if (glock_types_stats.has_key(key)): glock_types_stats[key].append(gtypes_stats.get(key)) else: glock_types_stats[key] = [gtypes_stats.get(key)] path_to_image_files += generate_date_graphs(path_to_output_dir, snapshot_date_time, glock_types_stats, "%s - %s" %(self.get_filesystem_name(), gstate), "Time of Snapshots", "Glock Types", png_format=png_format) return path_to_image_files
def __generate_graphs_glocks_holder_waiter(self, glocks_holder_waiters_by_date, snapshots_date_time, png_format=False): # The x-axis will be the snapshots_date_time. Each glock in the map has a # value that is holder/waiter count at some date_time (we call gdt) instance # that should be a value in the snapshots_date_time. If there is no gdt # instance for a date_time in snapshots_date_time then we set value at None # in graph. path_to_image_files = [] if ((glocks_holder_waiters_by_date) and (snapshots_date_time)): def get_index_in_list(date_time_list, date_time): index = 0; for index in range(0, len(date_time_list)): if (date_time_list[index] == date_time): return index index += 1 return -1 # Set the Y axis and create a list the same size as snapshots_date_time and set to None as each value. y_axis = {} for gkey in glocks_holder_waiters_by_date.keys(): if (not y_axis.has_key(gkey)): y_axis[gkey] = [None] * len(snapshots_date_time) for t in glocks_holder_waiters_by_date.get(gkey): index_in_dt = get_index_in_list(snapshots_date_time, t[0]) if (index_in_dt >= 0): y_axis[gkey][index_in_dt] = t[1] path_to_output_dir = os.path.join(os.path.join(self.get_path_to_output_dir(), self.get_filesystem_name()), "graphs") path_to_image_files += generate_date_graphs(path_to_output_dir, snapshots_date_time, y_axis, self.get_title(), "Time of Snapshots", "Glock Type/Inode", png_format=png_format) return path_to_image_files