* [Adeos-main] [PATCH 2/2] output minimum function trace overhead
@ 2007-01-08 22:21 Jan Kiszka
0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2007-01-08 22:21 UTC (permalink / raw)
To: Philippe Gerum; +Cc: adeos-main
[-- Attachment #1.1: Type: text/plain, Size: 250 bytes --]
This patch calibrates the best-case overhead a function trace point
introduces and dumps the result at the beginning of each tracer output.
Should give the reader of some trace an idea what the instrumentation
/at least/ costed per entry.
Jan
[-- Attachment #1.2: calc-trace-overhead.patch --]
[-- Type: text/plain, Size: 2770 bytes --]
---
kernel/ipipe/tracer.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
Index: linux-2.6.19-ipipe/kernel/ipipe/tracer.c
===================================================================
--- linux-2.6.19-ipipe.orig/kernel/ipipe/tracer.c
+++ linux-2.6.19-ipipe/kernel/ipipe/tracer.c
@@ -129,6 +129,7 @@ static int pre_trace = IPIPE_DEFAULT_PRE
static int post_trace = IPIPE_DEFAULT_POST_TRACE;
static int back_trace = IPIPE_DEFAULT_BACK_TRACE;
static int verbose_trace;
+static unsigned long trace_overhead;
static DEFINE_MUTEX(out_mutex);
static struct ipipe_trace_path *print_path;
@@ -824,6 +825,9 @@ static void __ipipe_print_dbgwarning(str
static void __ipipe_print_headline(struct seq_file *m)
{
+ seq_printf(m, "Calibrated minimum trace-point overhead: %lu.%03lu "
+ "us\n\n", trace_overhead/1000, trace_overhead%1000);
+
if (verbose_trace) {
const char *name[4] = { [0 ... 3] = "<unused>" };
struct list_head *pos;
@@ -917,7 +921,7 @@ static void *__ipipe_max_prtrace_start(s
UTS_RELEASE, IPIPE_ARCH_STRING);
__ipipe_print_dbgwarning(m);
seq_printf(m, "Begin: %lld cycles, Trace Points: %d (-%d/+%d), "
- "Length: %lu us\n\n",
+ "Length: %lu us\n",
print_path->point[print_path->begin].timestamp,
points, print_pre_trace, print_post_trace, length_usecs);
__ipipe_print_headline(m);
@@ -1073,7 +1077,7 @@ static void *__ipipe_frozen_prtrace_star
"------\n",
UTS_RELEASE, IPIPE_ARCH_STRING);
__ipipe_print_dbgwarning(m);
- seq_printf(m, "Freeze: %lld cycles, Trace Points: %d (+%d)\n\n",
+ seq_printf(m, "Freeze: %lld cycles, Trace Points: %d (+%d)\n",
print_path->point[print_path->begin].timestamp,
print_pre_trace+1, print_post_trace);
__ipipe_print_headline(m);
@@ -1200,6 +1204,8 @@ void __init __ipipe_init_tracer(void)
{
struct proc_dir_entry *trace_dir;
struct proc_dir_entry *entry;
+ unsigned long long start, end, min = ULLONG_MAX;
+ int i;
#ifdef CONFIG_IPIPE_TRACE_VMALLOC
int cpu, path;
@@ -1221,6 +1227,21 @@ void __init __ipipe_init_tracer(void)
ipipe_trace_enable = CONFIG_IPIPE_TRACE_ENABLE_VALUE;
#endif /* CONFIG_IPIPE_TRACE_VMALLOC */
+ /* Calculate minimum overhead of __ipipe_trace() */
+ local_irq_disable_hw();
+ for (i = 0; i < 100; i++) {
+ ipipe_read_tsc(start);
+ __ipipe_trace(IPIPE_TRACE_FUNC, __BUILTIN_RETURN_ADDRESS0,
+ __BUILTIN_RETURN_ADDRESS1, 0);
+ ipipe_read_tsc(end);
+
+ end -= start;
+ if (end < min)
+ min = end;
+ }
+ local_irq_enable_hw();
+ trace_overhead = ipipe_tsc2ns(min);
+
trace_dir = create_proc_entry("trace", S_IFDIR, ipipe_proc_root);
entry = create_proc_entry("max", 0644, trace_dir);
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-01-08 22:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-08 22:21 [Adeos-main] [PATCH 2/2] output minimum function trace overhead Jan Kiszka
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.