Skip to content

Commit

Permalink
trace-graph: Insert new task plots below the plot that they were sele…
Browse files Browse the repository at this point in the history
…cted on

When selecting to plot a task, insert the plot beneath the plot that it
was selected on.

Signed-off-by: Steven Rostedt <[email protected]>
  • Loading branch information
Steven Rostedt authored and rostedt committed Feb 11, 2010
1 parent 685beb7 commit 6ad565c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion trace-graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,15 @@ static void
plot_task_clicked (gpointer data)
{
struct graph_info *ginfo = data;
struct graph_plot *plot = ginfo->plot_clicked;
int pos;

if (plot)
pos = plot->pos + 1;
else
pos = ginfo->plots + 1;

graph_plot_task(ginfo, ginfo->filter_task_selected);
graph_plot_task(ginfo, ginfo->filter_task_selected, pos);
ginfo->draw_height = PLOT_SPACE(ginfo->plots);
redraw_graph(ginfo);
update_label_window(ginfo);
Expand Down
2 changes: 1 addition & 1 deletion trace-graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,6 @@ int trace_graph_plot_display_info(struct graph_info *ginfo,
void graph_plot_init_cpus(struct graph_info *ginfo, int cpus);

/* task plot */
void graph_plot_task(struct graph_info *ginfo, int pid);
void graph_plot_task(struct graph_info *ginfo, int pid, int pos);

#endif /* _TRACE_GRAPH_H */
4 changes: 2 additions & 2 deletions trace-plot-task.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ void graph_plot_init_tasks(struct graph_info *ginfo)
trace_graph_plot_insert(ginfo, 1, label, &task_plot_cb, task_info);
}

void graph_plot_task(struct graph_info *ginfo, int pid)
void graph_plot_task(struct graph_info *ginfo, int pid, int pos)
{
struct task_plot_info *task_info;
struct graph_plot *plot;
Expand All @@ -580,7 +580,7 @@ void graph_plot_task(struct graph_info *ginfo, int pid)
len = strlen(comm) + 100;
label = malloc_or_die(len);
snprintf(label, len, "%s-%d", comm, pid);
plot = trace_graph_plot_append(ginfo, label, &task_plot_cb, task_info);
plot = trace_graph_plot_insert(ginfo, pos, label, &task_plot_cb, task_info);
free(label);

trace_graph_plot_add_all_recs(ginfo, plot);
Expand Down

0 comments on commit 6ad565c

Please sign in to comment.