aboutsummaryrefslogtreecommitdiffstats
path: root/trace-plot-task.h
diff options
context:
space:
mode:
Diffstat (limited to 'trace-plot-task.h')
-rw-r--r--trace-plot-task.h118
1 files changed, 118 insertions, 0 deletions
diff --git a/trace-plot-task.h b/trace-plot-task.h
new file mode 100644
index 0000000..3232339
--- /dev/null
+++ b/trace-plot-task.h
@@ -0,0 +1,118 @@
1#ifndef __TRACE_PLOT_TASK_H
2#define __TRACE_PLOT_TASK_H
3
4#include <gtk/gtk.h>
5
6#include "trace-cmd.h"
7
8struct graph_info;
9struct graph_plot;
10struct plot_info;
11
12enum task_plot_type {
13 TASK_PLOT_OTHER,
14 TASK_PLOT_LINUX,
15 TASK_PLOT_RT
16};
17
18/**
19 * struct task_plot_info - information for plotting a single task
20 * @pid: pid to plot
21 * @cpu_data: state of each cpu
22 * @last_records: cache of recently accessed records
23 * @last_time: time of last record seen by this task graph
24 * @wake_time: time task resumed execution
25 * @display_wake_time: as above, but reset under some circumstances
26 * @wake_color:
27 * @last_cpu: cpu task is currently running on
28 * @type: type of task plot
29 */
30struct task_plot_info {
31 int pid;
32 struct cpu_data *cpu_data;
33 struct record **last_records;
34 unsigned long long last_time;
35 unsigned long long wake_time;
36 unsigned long long display_wake_time;
37 int wake_color;
38 int last_cpu;
39 enum task_plot_type type;
40};
41
42/* Querying records */
43gboolean is_running(struct graph_info *ginfo, struct record *record);
44gboolean record_matches_pid(struct graph_info *ginfo, struct record *record,
45 int match_pid, int *pid, int *sched_pid,
46 gboolean *is_sched, gboolean *wakeup);
47
48/* State maintenance */
49void update_last_task_record(struct graph_info *ginfo, struct task_plot_info *task_info,
50 struct record *record);
51
52/* Searching for records */
53#define MAX_SEARCH 20
54struct record *
55find_record(struct graph_info *ginfo, gint pid, guint64 time);
56struct record *find_previous_record(struct graph_info *ginfo,
57 struct record *start_record,
58 int pid, int cpu);
59struct record *get_display_record(struct graph_info *ginfo, int pid,
60 unsigned long long time);
61
62/* Seeking in data file */
63void set_cpu_to_time(int cpu, struct graph_info *ginfo, unsigned long long time);
64void set_cpus_to_time(struct graph_info *ginfo, unsigned long long time);
65
66/* Saving / restoring state */
67struct offset_cache {
68 guint64 *offsets;
69};
70struct offset_cache *save_offsets(struct graph_info *ginfo);
71void restore_offsets(struct graph_info *ginfo, struct offset_cache *offsets);
72
73/* Callbacks */
74int task_plot_match_time(struct graph_info *ginfo, struct graph_plot *plot,
75 unsigned long long time);
76int task_plot_display_last_event(struct graph_info *ginfo,
77 struct graph_plot *plot,
78 struct trace_seq *s,
79 unsigned long long time);
80void task_plot_start(struct graph_info *ginfo, struct graph_plot *plot,
81 unsigned long long time);
82int task_plot_event(struct graph_info *ginfo, struct graph_plot *plot,
83 struct record *record, struct plot_info *info);
84struct record *task_plot_find_record(struct graph_info *ginfo,
85 struct graph_plot *plot,
86 unsigned long long time);
87int task_plot_display_info(struct graph_info *ginfo,
88 struct graph_plot *plot,
89 struct trace_seq *s,
90 unsigned long long time);
91void task_plot_destroy(struct graph_info *ginfo, struct graph_plot *plot);
92
93/* Plot management */
94void graph_plot_task(struct graph_info *ginfo, int pid, int pos);
95void graph_plot_task_plotted(struct graph_info *ginfo,
96 gint **plotted);
97
98void graph_plot_task_update_callback(gboolean accept,
99 gint *selected,
100 gint *non_select,
101 gpointer data);
102
103void graph_plot_init_tasks(struct graph_info *ginfo);
104
105/* Shared functionality for inheriting structs */
106typedef void (plot_task_cb)(struct graph_info *ginfo, int pid, int pos);
107void graph_tasks_update_callback(enum task_plot_type type,
108 plot_task_cb plot_cb,
109 gboolean accept,
110 gint *selected,
111 gint *non_select,
112 gpointer data);
113void init_task_plot_info(struct graph_info *ginfo,
114 struct task_plot_info *task_info,
115 enum task_plot_type type, int pid);
116void graph_tasks_plotted(struct graph_info *ginfo, enum task_plot_type type,
117 gint **plotted);
118#endif