Re: [RFC/PATCH] Nonotify - A simplistic way to determine directory content changes



On Tue, 2004-06-01 at 12:06, Alexander Larsson wrote: 
> On Mon, 2004-05-31 at 20:13, nf wrote:
> > I have posted this to the kernel list. Might be interesting for the nautilus 
> > developers as well. Perhaps this could be used by "fam" instead of dnotify. 
> > Cause i don't see any problems with delivering events from a "polling" mechanism.
> > But i don't know if we really need fam in this case, or rather use it from 
> > gnome-vfs directly.
> 
> Not that this might not be a good idea, but your measurements are a bit
> skewed. I'm pretty sure that events could be done in a way that uses
> less resources (and doesn't block unmount), and what you're measuring is
> the worst-case for a notify approach.

When you write a file the regular way (not with "echo's", which
open/closes the file for every line), fam/dnotify "only" slows
file-writing down by about factor 2. Test-utility attached.

Alexander, another question: Do you think i should continue developing
nonotify? I have the feeling that anything less sophisticated than
dnotify&events won't get accepted anyway. 

The problem is how to bring the dcontents_mtime timestamp to userspace.
I guess it's hard to get an ok by the kernel-people for a new function
"sys_nonotify_stat()" in the syscall-table (to report atime, mtime,
ctime and dcontents_mtime).

Another option would be to open up a device and use an ioctl call - but
i don't know if the performance of that is good enough for nonotify's
purpose. Or add a field to the stat64 structure - which would break C
compatibility. :-(

Thanks, and sorry for beeing a bit unkind and provoking in my last mail.

Norbert


#include <stdio.h>
#include <sys/stat.h>
#include <sys/time.h>

#define DEBUG 0

int main(int argc, char ** argv) {

	FILE * fp;
	
	int i;
	int size;
	
	struct timeval start, stop;

	double elapsed;
	
	if (argc<=2) {
		fprintf(stderr, "usage: fambench_writefile filename size\n");
		return 1;
	}
	
	size = atoi(argv[2]);
	
	gettimeofday(&start, NULL);	

	fp = fopen(argv[1], "w");
	
	for (i=0;i<size;i++) {

		fputc((int)'*', fp);

	}
	
	fclose(fp);
	
	gettimeofday(&stop,NULL);

	printf ("char count=%d\n", size);
	printf ("start=%d sec %d usec\n", start.tv_sec, start.tv_usec);
	printf ("stop =%d sec %d usec\n", stop.tv_sec, stop.tv_usec);
	printf ("elapsed=%f sec\n", ((double)stop.tv_sec - (double)start.tv_sec) + ((double) stop.tv_usec - (double)start.tv_usec) * 0.000001);
	
	return 0;

}






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]