aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-02-11 08:48:27 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-02-11 08:48:27 -0500
commitb680c7a6397c359bfc3d99037e8bf1766c46a0ae (patch)
tree18935611440b5421c795bfaf9926e0ae8788e176
parent1ebd4ace97ff410a45fabac125ce4110f513ea51 (diff)
trace-graph: Limit task plot prev search by count not time
Since a time slot can hold thousands or just 1 event, search backwards in the task plot and limit it by 20 events not time by pixels. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-plot-task.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/trace-plot-task.c b/trace-plot-task.c
index 293ccec..fe109c4 100644
--- a/trace-plot-task.c
+++ b/trace-plot-task.c
@@ -405,9 +405,11 @@ task_plot_find_record(struct graph_info *ginfo, struct graph_plot *plot,
405 return find_record(ginfo, pid, time); 405 return find_record(ginfo, pid, time);
406} 406}
407 407
408#define MAX_SEARCH 20
409
408static struct record * 410static struct record *
409find_previous_record(struct graph_info *ginfo, struct record *start_record, 411find_previous_record(struct graph_info *ginfo, struct record *start_record,
410 int pid, int cpu, unsigned long long time) 412 int pid, int cpu)
411{ 413{
412 struct record *last_record = start_record; 414 struct record *last_record = start_record;
413 struct record *record; 415 struct record *record;
@@ -416,11 +418,13 @@ find_previous_record(struct graph_info *ginfo, struct record *start_record,
416 gboolean is_wakeup; 418 gboolean is_wakeup;
417 gint rec_pid; 419 gint rec_pid;
418 gint sched_pid; 420 gint sched_pid;
421 int count = 0;
419 422
420 if (!last_record) 423 if (!last_record)
421 last_record = tracecmd_read_cpu_last(ginfo->handle, cpu); 424 last_record = tracecmd_read_cpu_last(ginfo->handle, cpu);
422 425
423 while ((record = tracecmd_read_prev(ginfo->handle, last_record))) { 426 while ((record = tracecmd_read_prev(ginfo->handle, last_record))) {
427 count++;
424 428
425 match = record_matches_pid(ginfo, record, pid, &rec_pid, 429 match = record_matches_pid(ginfo, record, pid, &rec_pid,
426 &sched_pid, &is_sched, &is_wakeup); 430 &sched_pid, &is_sched, &is_wakeup);
@@ -430,7 +434,7 @@ find_previous_record(struct graph_info *ginfo, struct record *start_record,
430 if (last_record != start_record) 434 if (last_record != start_record)
431 free_record(last_record); 435 free_record(last_record);
432 436
433 if (record->ts < time) { 437 if (count > MAX_SEARCH) {
434 free_record(record); 438 free_record(record);
435 return NULL; 439 return NULL;
436 } 440 }
@@ -449,7 +453,6 @@ get_display_record(struct graph_info *ginfo, int pid, unsigned long long time)
449 struct record *record; 453 struct record *record;
450 struct record **records; 454 struct record **records;
451 unsigned long long ts; 455 unsigned long long ts;
452 unsigned long long limit;
453 int next_cpu; 456 int next_cpu;
454 int cpu; 457 int cpu;
455 458
@@ -465,15 +468,12 @@ get_display_record(struct graph_info *ginfo, int pid, unsigned long long time)
465 free_record(record); 468 free_record(record);
466 } 469 }
467 470
468 /* Only search 5 pixels back */
469 limit = time - (5 / ginfo->resolution);
470
471 /* find a previous record */ 471 /* find a previous record */
472 records = malloc_or_die(sizeof(*records) * ginfo->cpus); 472 records = malloc_or_die(sizeof(*records) * ginfo->cpus);
473 for (cpu = 0; cpu < ginfo->cpus; cpu++) { 473 for (cpu = 0; cpu < ginfo->cpus; cpu++) {
474 record = tracecmd_read_data(ginfo->handle, cpu); 474 record = tracecmd_read_data(ginfo->handle, cpu);
475 records[cpu] = find_previous_record(ginfo, record, 475 records[cpu] = find_previous_record(ginfo, record,
476 pid, cpu, limit); 476 pid, cpu);
477 free_record(record); 477 free_record(record);
478 } 478 }
479 479
@@ -500,7 +500,7 @@ get_display_record(struct graph_info *ginfo, int pid, unsigned long long time)
500 } 500 }
501 501
502 record = find_previous_record(ginfo, records[next_cpu], 502 record = find_previous_record(ginfo, records[next_cpu],
503 pid, next_cpu, limit); 503 pid, next_cpu);
504 free_record(records[next_cpu]); 504 free_record(records[next_cpu]);
505 records[next_cpu] = record; 505 records[next_cpu] = record;
506 record = NULL; 506 record = NULL;