mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
fix read and poll
This commit is contained in:
@ -20,7 +20,7 @@
|
|||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
MODULE_AUTHOR("Soeren Sandmann (sandmann@daimi.au.dk)");
|
MODULE_AUTHOR("Soeren Sandmann (sandmann@daimi.au.dk)");
|
||||||
|
|
||||||
#define SAMPLES_PER_SECOND (50)
|
#define SAMPLES_PER_SECOND (20)
|
||||||
#define INTERVAL (HZ / SAMPLES_PER_SECOND)
|
#define INTERVAL (HZ / SAMPLES_PER_SECOND)
|
||||||
#define N_TRACES 256
|
#define N_TRACES 256
|
||||||
|
|
||||||
@ -187,16 +187,13 @@ procfile_read(char *buffer,
|
|||||||
int *eof,
|
int *eof,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
wait_event_interruptible(wait_for_trace, head != tail);
|
|
||||||
|
|
||||||
if (buffer_len < sizeof (SysprofStackTrace))
|
if (buffer_len < sizeof (SysprofStackTrace))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memcpy (buffer, (char *)tail, sizeof (SysprofStackTrace));
|
wait_event_interruptible (wait_for_trace, head != tail);
|
||||||
|
*buffer_location = (char *)tail;
|
||||||
if (tail++ == &stack_traces[N_TRACES - 1])
|
if (tail++ == &stack_traces[N_TRACES - 1])
|
||||||
tail = &stack_traces[0];
|
tail = &stack_traces[0];
|
||||||
*buffer_location = buffer;
|
|
||||||
|
|
||||||
return sizeof (SysprofStackTrace);
|
return sizeof (SysprofStackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,6 +201,9 @@ struct proc_dir_entry *trace_proc_file;
|
|||||||
static unsigned int
|
static unsigned int
|
||||||
procfile_poll(struct file *filp, poll_table *poll_table)
|
procfile_poll(struct file *filp, poll_table *poll_table)
|
||||||
{
|
{
|
||||||
|
if (head != tail) {
|
||||||
|
return POLLIN | POLLRDNORM;
|
||||||
|
}
|
||||||
poll_wait(filp, &wait_for_trace, poll_table);
|
poll_wait(filp, &wait_for_trace, poll_table);
|
||||||
if (head != tail) {
|
if (head != tail) {
|
||||||
return POLLIN | POLLRDNORM;
|
return POLLIN | POLLRDNORM;
|
||||||
|
|||||||
Reference in New Issue
Block a user