+2007-10-20 Soren Sandmann <sandmann@daimi.au.dk>
+
+ * collector.c (on_read): Call callback with an extra boolean
+ indicating whether the sample read was the first one
+
+ * collector.c (add_trace_to_stash): Allocate addresses on the
+ stack if possible.
+
+ * sysprof.c (on_new_sample): Only call update_sensitivity() on the
+ first sample.
+
+ * stackstash.c (stack_stash_add_trace): Move match to front
+
2007-09-16 Soren Sandmann <sandmann@daimi.au.dk>
* process.c (process_lookup_kernel_symbol): Add support for
int n_addresses;
int n_kernel_words;
int a;
+ gulong addrs_stack[2048];
+ int n_alloc;
n_addresses = trace->n_addresses;
n_kernel_words = trace->n_kernel_words;
- addrs = g_new (gulong, n_addresses + n_kernel_words + 2);
+ n_alloc = n_addresses + n_kernel_words + 2;
+ if (n_alloc <= 2048)
+ addrs = addrs_stack;
+ else
+ addrs = g_new (gulong, n_alloc);
a = 0;
/* Add kernel addresses */
stack_stash_add_trace (
stash, addrs, a, 1);
- g_free (addrs);
+ if (addrs != addrs_stack)
+ g_free (addrs);
}
static gboolean
collector->n_samples++;
if (collector->callback)
- collector->callback (collector->data);
+ collector->callback (collector->n_samples == 1, collector->data);
}
}
typedef struct Collector Collector;
-typedef void (* CollectorFunc) (gpointer data);
+typedef void (* CollectorFunc) (gboolean first_sample,
+ gpointer data);
#define COLLECTOR_ERROR collector_error_quark ()
for (i = n_addrs - 1; i >= 0; --i)
{
StackNode *match = NULL;
- StackNode *n;
+ StackNode *prev;
- for (n = *location; n != NULL; n = n->siblings)
+ prev = NULL;
+ for (match = *location; match != NULL; prev = match, match = match->siblings)
{
- if (n->address == (gpointer)addrs[i])
+ if (match->address == (gpointer)addrs[i])
{
- match = n;
+ if (prev)
+ {
+ /* move to front */
+ prev->siblings = match->siblings;
+ match->siblings = *location;
+ *location = match;
+ }
+
break;
}
}
}
static void
-on_new_sample (gpointer data)
+on_new_sample (gboolean first_sample,
+ gpointer data)
{
Application *app = data;
- if (app->state == PROFILING)
+ if (app->state == PROFILING && first_sample)
update_sensitivity (app);
+ else
+ queue_show_samples (app);
}
static Application *