Communicate traces to userspace through shared memory instead of copying.

2006-10-22  Soren Sandmann <sandmann@daimi.au.dk>

	Communicate traces to userspace through shared memory instead of
	copying.

	* module/sysprof-module.c: Store the traces in a SysprofMmapArea.
	(sysprof_mmap): Implement this method.
	(sysprof_nopage): Implement this.
	(sysprof_read): Just reset the tail pointer and return zero.

	* module/sysprof-module.h (struct SysprofMmapArea): New
	structure.

	* collector.c (collector_stop): Unmap the device
	(in_dead_period): New function
	(on_read): Read the traces out of mmap()ed area instead of reading
	them. Call read() to prevent poll() from firing.
	(struct Collector): New members map_area and current.

	* Makefile.am (insert-module): Prefix modprobe with /sbin

	* collector.c (open_fd): mmap() the sysprof device.
This commit is contained in:
Soren Sandmann
2006-10-23 03:46:25 +00:00
committed by Søren Sandmann Pedersen
parent 5eb19d00fa
commit 4dd37d092c
5 changed files with 175 additions and 76 deletions

View File

@ -20,10 +20,11 @@
#ifndef SYSPROF_MODULE_H
#define SYSPROF_MODULE_H
#define SYSPROF_FILE "/dev/sysprof-trace"
typedef struct SysprofStackTrace SysprofStackTrace;
typedef struct SysprofStackInfo SysprofStackInfo;
typedef struct SysprofMmapArea SysprofMmapArea;
#define SYSPROF_N_TRACES 256
#define SYSPROF_MAX_ADDRESSES 512
struct SysprofStackTrace
@ -36,4 +37,11 @@ struct SysprofStackTrace
void *addresses[SYSPROF_MAX_ADDRESSES];
};
struct SysprofMmapArea
{
unsigned int head;
SysprofStackTrace traces[SYSPROF_N_TRACES];
};
#endif