diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2010-02-10 21:30:44 -0500 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2010-02-10 21:30:44 -0500 |
| commit | d4dfdb40e94aa48899e1e11b0bc4309d35d45424 (patch) | |
| tree | 23e6d46f1ffa72d0e64f65c6af8a3e29ed952df6 | |
| parent | 690c9608a53a9b90f5a7fc55c5da99ba861008bb (diff) | |
trace-graph: Limit the search back for task plots display data
The task plot was search every CPU for a matching event. If a CPU did
not have any events for a given plot, it would search all the way back to the
start! This caused a huge delay in processing and would hang trace-graph
for seconds while it would search the cpu data backwards.
Limit the distance to only 5 pixels in its search.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
| -rw-r--r-- | trace-plot-task.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/trace-plot-task.c b/trace-plot-task.c index ecbf873..c92adb9 100644 --- a/trace-plot-task.c +++ b/trace-plot-task.c | |||
| @@ -377,7 +377,7 @@ task_plot_find_record(struct graph_info *ginfo, struct graph_plot *plot, | |||
| 377 | 377 | ||
| 378 | static struct record * | 378 | static struct record * |
| 379 | find_previous_record(struct graph_info *ginfo, struct record *start_record, | 379 | find_previous_record(struct graph_info *ginfo, struct record *start_record, |
| 380 | int pid, int cpu) | 380 | int pid, int cpu, unsigned long long time) |
| 381 | { | 381 | { |
| 382 | struct record *last_record = start_record; | 382 | struct record *last_record = start_record; |
| 383 | struct record *record; | 383 | struct record *record; |
| @@ -399,6 +399,11 @@ find_previous_record(struct graph_info *ginfo, struct record *start_record, | |||
| 399 | 399 | ||
| 400 | if (last_record != start_record) | 400 | if (last_record != start_record) |
| 401 | free_record(last_record); | 401 | free_record(last_record); |
| 402 | |||
| 403 | if (record->ts < time) { | ||
| 404 | free_record(record); | ||
| 405 | return NULL; | ||
| 406 | } | ||
| 402 | last_record = record; | 407 | last_record = record; |
| 403 | } | 408 | } |
| 404 | 409 | ||
| @@ -414,6 +419,7 @@ get_display_record(struct graph_info *ginfo, int pid, unsigned long long time) | |||
| 414 | struct record *record; | 419 | struct record *record; |
| 415 | struct record **records; | 420 | struct record **records; |
| 416 | unsigned long long ts; | 421 | unsigned long long ts; |
| 422 | unsigned long long limit; | ||
| 417 | int next_cpu; | 423 | int next_cpu; |
| 418 | int cpu; | 424 | int cpu; |
| 419 | 425 | ||
| @@ -429,11 +435,15 @@ get_display_record(struct graph_info *ginfo, int pid, unsigned long long time) | |||
| 429 | free_record(record); | 435 | free_record(record); |
| 430 | } | 436 | } |
| 431 | 437 | ||
| 438 | /* Only search 5 pixels back */ | ||
| 439 | limit = time - (5 / ginfo->resolution); | ||
| 440 | |||
| 432 | /* find a previous record */ | 441 | /* find a previous record */ |
| 433 | records = malloc_or_die(sizeof(*records) * ginfo->cpus); | 442 | records = malloc_or_die(sizeof(*records) * ginfo->cpus); |
| 434 | for (cpu = 0; cpu < ginfo->cpus; cpu++) { | 443 | for (cpu = 0; cpu < ginfo->cpus; cpu++) { |
| 435 | record = tracecmd_read_data(ginfo->handle, cpu); | 444 | record = tracecmd_read_data(ginfo->handle, cpu); |
| 436 | records[cpu] = find_previous_record(ginfo, record, pid, cpu); | 445 | records[cpu] = find_previous_record(ginfo, record, |
| 446 | pid, cpu, limit); | ||
| 437 | free_record(record); | 447 | free_record(record); |
| 438 | } | 448 | } |
| 439 | 449 | ||
| @@ -459,7 +469,8 @@ get_display_record(struct graph_info *ginfo, int pid, unsigned long long time) | |||
| 459 | break; | 469 | break; |
| 460 | } | 470 | } |
| 461 | 471 | ||
| 462 | record = find_previous_record(ginfo, records[next_cpu], pid, next_cpu); | 472 | record = find_previous_record(ginfo, records[next_cpu], |
| 473 | pid, next_cpu, limit); | ||
| 463 | free_record(records[next_cpu]); | 474 | free_record(records[next_cpu]); |
| 464 | records[next_cpu] = record; | 475 | records[next_cpu] = record; |
| 465 | record = NULL; | 476 | record = NULL; |
