471,344 Members | 1,425 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,344 software developers and data experts.

monitoring the filesystem for changes

hello,
i have designed a desktop search utility in python and a file system
monitoring using readdirectorychangesw from win32api but for eg. it
has a high cpu utilization (using a 2GHz processor).
a solution ntfs change journal proposed here works only for ntfs
partitions
is there another low (processor) cost alternative that works on fat32
partitions as well.
Rohit

Jun 2 '07 #1
4 3467
i have designed a desktop search utility in python and a file system
monitoring using readdirectorychangesw from win32api but for eg. it
has a high cpu utilization (using a 2GHz processor).
I don't think so. I just build a service to monitor a directory
changes using readdirectorychangesw, the cpu usage is not above 1.9%
for this service(my computer's cpu is 1.7GHz). if you still think 1.9%
is high cpu utilization, I think you can use the c to implements this
function, the cpu usage seems none for this application(I tried c dll
solution first).
Wish this help to you.

Wang Wei

Jun 3 '07 #2
hello
well in my implementation of readdirectorychangesw i am using
threading that is multiple programs run simultaneously each program
monitoring one drive for changes.
is their a way around this...one program for all drives?
thanks
rohit

Jun 3 '07 #3
rohit wrote:
hello
well in my implementation of readdirectorychangesw i am using
threading that is multiple programs run simultaneously each program
monitoring one drive for changes.
is their a way around this...one program for all drives?
thanks
You could use the ReadDirectoryChangesW in overlapped
mode. I've never tried it, so I don't know how
robust it would be. Why is it a problem to have
"multiple programs" running? And is that simply
multiple threads, or multiple processes?

TJG
Jun 3 '07 #4
You could use the ReadDirectoryChangesW in overlapped
mode. I've never tried it, so I don't know how
robust it would be. Why is it a problem to have
"multiple programs" running? And is that simply
multiple threads, or multiple processes?
I used overlapped in my program, it runs about 1 week, seems no
problems now.
FILE_LIST_DIRECTORY = 0x0001
hDir = None

def __init__(self, directory):
self.hDir = win32file.CreateFile (
directory,
self.FILE_LIST_DIRECTORY,
win32con.FILE_SHARE_READ | win32con.FILE_SHARE_WRITE,
None,
win32con.OPEN_EXISTING,
win32con.FILE_FLAG_BACKUP_SEMANTICS|
win32con.FILE_FLAG_OVERLAPPED,
None
)
but I didn't try use multiple program do the same action. I think only
one thread to do directory monitor is enough. other thread and process
can communicate with it use thread or process communication.

Wang Wei
Jun 4 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by johnm | last post: by
reply views Thread by Jeff Reed | last post: by
5 posts views Thread by Joe | last post: by
5 posts views Thread by rohit | last post: by
3 posts views Thread by rohit | last post: by
reply views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.