aboutsummaryrefslogtreecommitdiffstats
path: root/rt-plot-task.c
diff options
context:
space:
mode:
Diffstat (limited to 'rt-plot-task.c')
-rw-r--r--rt-plot-task.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/rt-plot-task.c b/rt-plot-task.c
new file mode 100644
index 0000000..d63c872
--- /dev/null
+++ b/rt-plot-task.c
@@ -0,0 +1,54 @@
1#include "trace-graph.h"
2
3static const struct plot_callbacks rt_task_cb = {
4 .match_time = task_plot_match_time,
5 .plot_event = task_plot_event,
6 .start = task_plot_start,
7 .display_last_event = task_plot_display_last_event,
8 .find_record = task_plot_find_record,
9 .display_info = task_plot_display_info,
10 .destroy = task_plot_destroy
11};
12
13void rt_plot_task_update_callback(gboolean accept,
14 gint *selected,
15 gint *non_select,
16 gpointer data)
17{
18 graph_tasks_update_callback(TASK_PLOT_RT, rt_plot_task,
19 accept, selected, non_select, data);
20}
21
22void rt_plot_task_plotted(struct graph_info *ginfo, gint **plotted)
23{
24 graph_tasks_plotted(ginfo, TASK_PLOT_RT, plotted);
25}
26
27void rt_plot_task(struct graph_info *ginfo, int pid, int pos)
28{
29 struct rt_graph_info *rtinfo = &ginfo->rtinfo;
30 struct rt_task_info *rt_task;
31 struct graph_plot *plot;
32 const char *comm;
33 char *label;
34 int len;
35
36 if (!find_task_list(rtinfo->tasks, pid))
37 die("Cannot create RT plot of non-RT task %d!\n", pid);
38
39 rt_task = malloc_or_die(sizeof(*rt_task));
40
41 init_task_plot_info(ginfo, &rt_task->base, TASK_PLOT_RT, pid);
42
43 comm = pevent_data_comm_from_pid(ginfo->pevent, pid);
44 len = strlen(comm) + 100;
45 label = malloc_or_die(len);
46 snprintf(label, len, "*%s-%d", comm, pid);
47
48 plot = trace_graph_plot_insert(ginfo, pos, label, PLOT_TYPE_TASK,
49 &rt_task_cb, rt_task);
50 free(label);
51
52 trace_graph_plot_add_all_recs(ginfo, plot);
53}
54