2007-11-16 Soren Sandmann <sandmann@daimi.au.dk>
+ * TODO: updates
+
+ * module/sysprof-module.c (sysprof_poll): Only select readable
+ when there is at least eight traces available
+
+ * collector.c (collect_traces): New function, old on_read()
+
+ * collector.c (collector_create_profile): Collect traces here as
+ well.
+
+2007-11-16 Soren Sandmann <sandmann@daimi.au.dk>
+
* TODO: Updates
* process.c (process_locate_map): Move map to front
Before 1.2:
-* If we profile something that is not very CPU bound, sysprof itself
- seems to get a disproportionate amount of the samples. Should look into this.
-
* Is the move-to-front in process_locate_map() really worth it?
* Apparently, if you upgrade the kernel, then don't re-run configure,
-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ALREADY DONE: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+* If we profile something that is not very CPU bound, sysprof itself
+ seems to get a disproportionate amount of the samples. Should look
+ into this. Fixed by only returning from poll when there is more
+ than eight traces available.
+
* regarding crossing system call barriers: Find out about the virtual dso
that linux uses to do fast system calls:
}
static void
-on_read (gpointer data)
+collect_traces (Collector *collector)
{
- Collector *collector = data;
- char c;
-
- /* Make sure poll() doesn't fire immediately again */
- read (collector->fd, &c, 1);
-
/* After a reset we ignore samples for a short period so that
* a reset will actually cause 'samples' to become 0
*/
collector->current = collector->map_area->head;
return;
}
-
+
while (collector->current != collector->map_area->head)
{
const SysprofStackTrace *trace;
}
}
+static void
+on_read (gpointer data)
+{
+ Collector *collector = data;
+ char c;
+
+ /* Make sure poll() doesn't fire immediately again */
+ read (collector->fd, &c, 1);
+
+ collect_traces (collector);
+}
+
static gboolean
load_module (void)
{
{
ResolveInfo info;
Profile *profile;
+
+ collect_traces (collector);
info.resolved_stash = stack_stash_new ((GDestroyNotify)g_free);
info.unique_symbols = g_hash_table_new (g_direct_hash, g_direct_equal);
return 0;
}
+static int
+n_traces_available (SysprofStackTrace *tail)
+{
+ SysprofStackTrace *head = &(area->traces[area->head]);
+
+ if (head >= tail)
+ return head - tail;
+ else
+ return SYSPROF_N_TRACES - (tail - head);
+}
+
static unsigned int
sysprof_poll(struct file *file, poll_table *poll_table)
{
SysprofStackTrace *tail = file->private_data;
- if (&(area->traces[area->head]) != tail)
+ if (n_traces_available (tail) >= 8)
return POLLIN | POLLRDNORM;
poll_wait(file, &wait_for_trace, poll_table);
- if (&(area->traces[area->head]) != tail)
+ if (n_traces_available (tail) >= 8)
return POLLIN | POLLRDNORM;
return 0;