ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Ubuntu Hardy Desktop, Solaris 10, Workstation 2008 x64
Posts: 75
Rep:
Benchmarking Web Spider
Basically, what i would like is 'wget -r' with timing information for each webpage downloaded, formated in either csv or something relativly easy to work with...
I thought that this could be the kinda thing that people might have in their 'toolchain', but if not and if i build one I'll throw it up on here.
Many Thanks
G
PS Checked Similar threads and some guy was looking for a client side web server benchmark, which i assume would be like this, but didnt get any response; hope i am luckier.
Distribution: Ubuntu Hardy Desktop, Solaris 10, Workstation 2008 x64
Posts: 75
Original Poster
Rep:
Awk Version
Using this awk script
Code:
BEGIN { inRecord = 0
thisPage = ""
startTime = ""
endTime = ""
}
function timeDiff(startTime, endTime, result, Eseconds, Sseconds) {
# seconds minutes hours
Sseconds=(substr(start,7,2)+(60*substr(start,4,2))+(360*substr(start,1,2)));
Eseconds=(substr(end,7,2)+(60*substr(end,4,2))+(360*substr(end,1,2)));
result=(Eseconds-Sseconds);
return result;
}
{
if ( inRecord == 1 ){
endTime = match($0,/^[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/);
if ( $0 ~ /\[following\]/ ) {
#this means its going somewhere else and will start a new download record
inRecord = 0;
} else if ( endTime )
#have completed download
inRecord = 0;
if ( $0 !~ /ERROR/ ) {
# Calculate times and print record here
print $4,timeDiff( startTime, endTime ),startTime,endTime;
}
} else {;}
else{
if ( $0 ~ /^--[0-9][0-9]:[0-9][0-9]:[0-9][0-9]--/ ) {
#starting a download
inRecord = 1;
startTime = match($0,/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/);
}
}
}
I get this error
Code:
awk: syntax error near line 7
awk: bailing out near line 7
Line seven is the function definition, but either I've drank too much coffee or I'm just being stupid but i cant see whats wrong with it.
Any ideas?
Many Thanks
PS I know its no where near "functionally complete", lol
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.