aboutsummaryrefslogtreecommitdiffstats
path: root/trace-plot-cpu.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-02-10 16:10:10 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-02-10 16:10:10 -0500
commit6386dc2ff83f321883f5eecb40f0b6ab414f9e46 (patch)
treed0f2e424e7775953eeda6b722357cb41495579a8 /trace-plot-cpu.c
parentdba6a8c6df54f095f31c14190a1a524710be3606 (diff)
trace-graph: Add destructor routine to plot callbacks
Added a destructor routine to the plot callbacks to be called before the plot is destroyed. This allows the plot to clean up any resources that it allocated before it is freed. Also did some other minor clean ups and freeing. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'trace-plot-cpu.c')
-rw-r--r--trace-plot-cpu.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/trace-plot-cpu.c b/trace-plot-cpu.c
index 6918ae4..7fd9ecc 100644
--- a/trace-plot-cpu.c
+++ b/trace-plot-cpu.c
@@ -4,7 +4,6 @@
4 4
5struct cpu_plot_info { 5struct cpu_plot_info {
6 int cpu; 6 int cpu;
7 struct record *record;
8 unsigned long long last_time; 7 unsigned long long last_time;
9 int last_pid; 8 int last_pid;
10}; 9};
@@ -177,7 +176,6 @@ static void cpu_plot_start(struct graph_info *ginfo, struct graph_plot *plot,
177 int cpu; 176 int cpu;
178 177
179 cpu = cpu_info->cpu; 178 cpu = cpu_info->cpu;
180 cpu_info->record = NULL;
181 cpu_info->last_time = 0ULL; 179 cpu_info->last_time = 0ULL;
182 cpu_info->last_pid = -1; 180 cpu_info->last_pid = -1;
183 181
@@ -396,6 +394,13 @@ int cpu_plot_display_info(struct graph_info *ginfo,
396 return 1; 394 return 1;
397} 395}
398 396
397void cpu_plot_destroy(struct graph_info *ginfo, struct graph_plot *plot)
398{
399 struct cpu_plot_info *cpu_info = plot->private;
400
401 free(cpu_info);
402}
403
399static const struct plot_callbacks cpu_plot_cb = { 404static const struct plot_callbacks cpu_plot_cb = {
400 .match_time = cpu_plot_match_time, 405 .match_time = cpu_plot_match_time,
401 .plot_event = cpu_plot_event, 406 .plot_event = cpu_plot_event,
@@ -403,6 +408,7 @@ static const struct plot_callbacks cpu_plot_cb = {
403 .display_last_event = cpu_plot_display_last_event, 408 .display_last_event = cpu_plot_display_last_event,
404 .find_record = cpu_plot_find_record, 409 .find_record = cpu_plot_find_record,
405 .display_info = cpu_plot_display_info, 410 .display_info = cpu_plot_display_info,
411 .destroy = cpu_plot_destroy
406}; 412};
407 413
408void graph_plot_init_cpus(struct graph_info *ginfo, int cpus) 414void graph_plot_init_cpus(struct graph_info *ginfo, int cpus)