monitoring the filesystem for changes

R

rohit

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
 
M

momobear

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
 
R

rohit

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
 
T

Tim Golden

rohit said:
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
 
M

momobear

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top