aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-06-09 15:06:17 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-06-09 15:06:17 -0400
commit5a863b6e82eff4ea370b9f44992172f8263a1c71 (patch)
tree6b2a4309f15aa0ec064e16f9769a86e3c7dc1231
parent4b9e3dca949377618759913d8b2891200e2231d1 (diff)
trace-graph: Use ref_count instead of comparisons
In find_previous_record in the trace-plot, instead of checking if the last_record is equal to the start_record, simply up the ref count. Then the free will not free the start_record. This makes the code a bit cleaner. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-plot-task.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/trace-plot-task.c b/trace-plot-task.c
index 0c9f8e0..c8d0905 100644
--- a/trace-plot-task.c
+++ b/trace-plot-task.c
@@ -464,7 +464,9 @@ find_previous_record(struct graph_info *ginfo, struct record *start_record,
464 gint sched_pid; 464 gint sched_pid;
465 int count = 0; 465 int count = 0;
466 466
467 if (!last_record) 467 if (last_record)
468 last_record->ref_count++;
469 else
468 last_record = tracecmd_read_cpu_last(ginfo->handle, cpu); 470 last_record = tracecmd_read_cpu_last(ginfo->handle, cpu);
469 471
470 while ((record = tracecmd_read_prev(ginfo->handle, last_record))) { 472 while ((record = tracecmd_read_prev(ginfo->handle, last_record))) {
@@ -475,8 +477,7 @@ find_previous_record(struct graph_info *ginfo, struct record *start_record,
475 if (match) 477 if (match)
476 break; 478 break;
477 479
478 if (last_record != start_record) 480 free_record(last_record);
479 free_record(last_record);
480 481
481 if (count > MAX_SEARCH) { 482 if (count > MAX_SEARCH) {
482 free_record(record); 483 free_record(record);
@@ -485,8 +486,7 @@ find_previous_record(struct graph_info *ginfo, struct record *start_record,
485 last_record = record; 486 last_record = record;
486 } 487 }
487 488
488 if (last_record != start_record) 489 free_record(last_record);
489 free_record(last_record);
490 490
491 return record; 491 return record;
492} 492}