Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Problem in access time

Reply
Thread Tools

Problem in access time

 
 
sanjeeb
Guest
Posts: n/a
 
      05-01-2006
Hey
I have written a code to know the files read by a tool during
execution so that i can anlyze that files only. The problem is that it
is not showing any file that was read. i checked manually(by renaming
the files and executing the tool, if it gives error means its read the
file) to know the files read during the execution of the tool(rom
tool).

Logic

1. Record the time at the start of the script.
2. Record the time at the end of the tool execution(rom).
3. Check the access time in the specified directory of each file using
stat.
4. If the access time is greater then the $time_start and less then the
$time_end
print the file name.

OS: WinXp, Active perl
Drive used: Virtual.


The tool is calling a batch file and the batch file in turn calls some
perl tool. The perl tool opens some file inside the script which are
present in the specified directory, but unfortunately it didnt show
that files.

1. Is there portability issue in the stat?
2. Is there any unkown bug in the code?
3. If a scipt open a file using "open", will it update the access time?
4. Is there any problem in the resolution, i think access time gives in
seconds(thats why i added a sleep after the "system" command).







Snippet of the code

###########################
use strict;
my $time_start = time;


system("rom -v coral -inst armv5 -build urel -s");
sleep(2);

my $time_end = time;


print "Time taken ($time_start - $time_end)\n";

use File::Find;

my @directories_to_search =
('C:\\J_Laptop\\J_Symbian\\eshell-min\\src\\cedar\\generic\\base\\e32\\rombuild');
print "\n";

find(\&wanted, @directories_to_search);




sub wanted {

if (-f $File::Find::name) {

my $st = stat($File::Find::name);
my $accessTime = $st->atime;
if ($accessTime >= $time_start && $accessTime <= $time_end) {

print "Files accessed #### $File::Find::name \n";
}

}

}


####################

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is time.time() < time.time() always true? flamesrock Python 8 11-24-2006 06:51 AM
Re: interpreting the fractional portion of time.clock() vs time.time(0measurements Peter Hansen Python 0 02-22-2006 02:02 PM
Re: interpreting the fractional portion of time.clock() vs time.time()measurements Peter Hansen Python 0 02-22-2006 12:03 AM
time.clock() or time.time() peterbe@gmail.com Python 8 08-05-2005 01:51 PM
delta time = time stop - time start engsol Python 2 01-26-2004 12:06 PM



Advertisments