[RFC PATCH 18/22 -v2] Sort trace by timestamp
Now that each entry has a reliable timestamp, we can use the timestamp as the source of sorting the trace and remove the atomic increment. Signed-off-by: Steven Rostedt <[EMAIL PROTECTED]> --- lib/tracing/tracer.c |3 +-- lib/tracing/tracer.h |2 -- 2 files changed, 1 insertion(+), 4 deletions(-) Index: linux-compile-i386.git/lib/tracing/tracer.c === --- linux-compile-i386.git.orig/lib/tracing/tracer.c2008-01-09 14:35:58.0 -0500 +++ linux-compile-i386.git/lib/tracing/tracer.c 2008-01-09 15:17:25.0 -0500 @@ -59,7 +59,6 @@ mctracer_add_trace_entry(struct mctracer atomic_inc(>underrun); entry = data->trace + idx * MCTRACER_ENTRY_SIZE; - entry->idx = atomic_inc_return(>cnt); entry->ip= ip; entry->parent_ip = parent_ip; entry->pid = tsk->pid; @@ -142,7 +141,7 @@ static void *find_next_entry(struct mctr if (!tr->data[i]->trace) continue; ent = mctracer_entry_idx(tr, iter->next_idx[i], i); - if (ent && (!next || next->idx > ent->idx)) { + if (ent && (!next || next->t > ent->t)) { next = ent; next_i = i; } Index: linux-compile-i386.git/lib/tracing/tracer.h === --- linux-compile-i386.git.orig/lib/tracing/tracer.h2008-01-09 14:35:11.0 -0500 +++ linux-compile-i386.git/lib/tracing/tracer.h 2008-01-09 15:17:24.0 -0500 @@ -6,7 +6,6 @@ struct mctracer_entry { unsigned long long t; - unsigned long idx; unsigned long ip; unsigned long parent_ip; char comm[TASK_COMM_LEN]; @@ -24,7 +23,6 @@ struct mctracer_trace { unsigned long entries; long ctrl; unsigned long iter_flags; - atomic_t cnt; struct mctracer_trace_cpu *data[NR_CPUS]; }; -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[RFC PATCH 18/22 -v2] Sort trace by timestamp
Now that each entry has a reliable timestamp, we can use the timestamp as the source of sorting the trace and remove the atomic increment. Signed-off-by: Steven Rostedt [EMAIL PROTECTED] --- lib/tracing/tracer.c |3 +-- lib/tracing/tracer.h |2 -- 2 files changed, 1 insertion(+), 4 deletions(-) Index: linux-compile-i386.git/lib/tracing/tracer.c === --- linux-compile-i386.git.orig/lib/tracing/tracer.c2008-01-09 14:35:58.0 -0500 +++ linux-compile-i386.git/lib/tracing/tracer.c 2008-01-09 15:17:25.0 -0500 @@ -59,7 +59,6 @@ mctracer_add_trace_entry(struct mctracer atomic_inc(data-underrun); entry = data-trace + idx * MCTRACER_ENTRY_SIZE; - entry-idx = atomic_inc_return(tr-cnt); entry-ip= ip; entry-parent_ip = parent_ip; entry-pid = tsk-pid; @@ -142,7 +141,7 @@ static void *find_next_entry(struct mctr if (!tr-data[i]-trace) continue; ent = mctracer_entry_idx(tr, iter-next_idx[i], i); - if (ent (!next || next-idx ent-idx)) { + if (ent (!next || next-t ent-t)) { next = ent; next_i = i; } Index: linux-compile-i386.git/lib/tracing/tracer.h === --- linux-compile-i386.git.orig/lib/tracing/tracer.h2008-01-09 14:35:11.0 -0500 +++ linux-compile-i386.git/lib/tracing/tracer.h 2008-01-09 15:17:24.0 -0500 @@ -6,7 +6,6 @@ struct mctracer_entry { unsigned long long t; - unsigned long idx; unsigned long ip; unsigned long parent_ip; char comm[TASK_COMM_LEN]; @@ -24,7 +23,6 @@ struct mctracer_trace { unsigned long entries; long ctrl; unsigned long iter_flags; - atomic_t cnt; struct mctracer_trace_cpu *data[NR_CPUS]; }; -- -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/