aboutsummaryrefslogtreecommitdiffstats
path: root/trace-plot-task.c
diff options
context:
space:
mode:
Diffstat (limited to 'trace-plot-task.c')
-rw-r--r--trace-plot-task.c53
1 files changed, 16 insertions, 37 deletions
diff --git a/trace-plot-task.c b/trace-plot-task.c
index abcdd89..d4b608b 100644
--- a/trace-plot-task.c
+++ b/trace-plot-task.c
@@ -713,10 +713,16 @@ static const struct plot_callbacks task_plot_cb = {
713 .destroy = task_plot_destroy 713 .destroy = task_plot_destroy
714}; 714};
715 715
716 716/**
717void graph_tasks_plotted(struct graph_info *ginfo, 717 * graph_plot_task_plotted - return what tasks are plotted
718 enum task_plot_type type, 718 * @ginfo: the graph info structure
719 gint **plotted) 719 * @plotted: returns an allocated array of gints holding the pids.
720 * the last pid is -1, NULL, if none are.
721 *
722 * @plotted must be freed with free() after this is called.
723 */
724void graph_plot_task_plotted(struct graph_info *ginfo,
725 gint **plotted)
720{ 726{
721 struct task_plot_info *task_info; 727 struct task_plot_info *task_info;
722 struct graph_plot *plot; 728 struct graph_plot *plot;
@@ -733,21 +739,7 @@ void graph_tasks_plotted(struct graph_info *ginfo,
733 } 739 }
734} 740}
735 741
736/** 742void graph_tasks_update_callback(enum graph_plot_type type,
737 * graph_plot_task_plotted - return what tasks are plotted
738 * @ginfo: the graph info structure
739 * @plotted: returns an allocated array of gints holding the pids.
740 * the last pid is -1, NULL, if none are.
741 *
742 * @plotted must be freed with free() after this is called.
743 */
744void graph_plot_task_plotted(struct graph_info *ginfo,
745 gint **plotted)
746{
747 graph_tasks_plotted(ginfo, TASK_PLOT_LINUX, plotted);
748}
749
750void graph_tasks_update_callback(enum task_plot_type type,
751 plot_task_cb plot_cb, 743 plot_task_cb plot_cb,
752 gboolean accept, 744 gboolean accept,
753 gint *selected, 745 gint *selected,
@@ -778,12 +770,9 @@ void graph_tasks_update_callback(enum task_plot_type type,
778 */ 770 */
779 for (i = ginfo->plots - 1; i >= 0; i--) { 771 for (i = ginfo->plots - 1; i >= 0; i--) {
780 plot = ginfo->plot_array[i]; 772 plot = ginfo->plot_array[i];
781 if (plot->type != PLOT_TYPE_TASK) 773 if (plot->type != type)
782 continue; 774 continue;
783
784 task_info = plot->private; 775 task_info = plot->private;
785 if (task_info->type != type)
786 continue;
787 776
788 /* If non are selected, then remove all */ 777 /* If non are selected, then remove all */
789 if (!select_size) { 778 if (!select_size) {
@@ -819,7 +808,7 @@ void graph_plot_task_update_callback(gboolean accept,
819 gint *non_select, 808 gint *non_select,
820 gpointer data) 809 gpointer data)
821{ 810{
822 graph_tasks_update_callback(TASK_PLOT_LINUX, graph_plot_task, 811 graph_tasks_update_callback(PLOT_TYPE_TASK, graph_plot_task,
823 accept, selected, non_select, data); 812 accept, selected, non_select, data);
824} 813}
825 814
@@ -850,17 +839,6 @@ void graph_plot_init_tasks(struct graph_info *ginfo)
850 &task_plot_cb, task_info); 839 &task_plot_cb, task_info);
851} 840}
852 841
853void init_task_plot_info(struct graph_info *ginfo,
854 struct task_plot_info *task_info,
855 enum task_plot_type type,
856 int pid)
857{
858 task_info->last_records =
859 malloc_or_die(sizeof(struct record *) * ginfo->cpus);
860 task_info->pid = pid;
861 task_info->type = type;
862}
863
864void graph_plot_task(struct graph_info *ginfo, int pid, int pos) 842void graph_plot_task(struct graph_info *ginfo, int pid, int pos)
865{ 843{
866 struct task_plot_info *task_info; 844 struct task_plot_info *task_info;
@@ -870,8 +848,9 @@ void graph_plot_task(struct graph_info *ginfo, int pid, int pos)
870 int len; 848 int len;
871 849
872 task_info = malloc_or_die(sizeof(*task_info)); 850 task_info = malloc_or_die(sizeof(*task_info));
873 851 task_info->last_records =
874 init_task_plot_info(ginfo, task_info, TASK_PLOT_LINUX, pid); 852 malloc_or_die(sizeof(struct record *) * ginfo->cpus);
853 task_info->pid = pid;
875 854
876 comm = pevent_data_comm_from_pid(ginfo->pevent, pid); 855 comm = pevent_data_comm_from_pid(ginfo->pevent, pid);
877 856