Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Measuring response time from a URL
Hi All,

I want to execute a shell script which returns the response time from
a URL (using wget(?)). Can this be done through a shell script and
how? The OS in linux.


Thanks in advance,

ZM


Report this thread to moderator Post Follow-up to this message
Old Post
Zinger
04-03-08 12:41 AM


Re: Measuring response time from a URL

On 4/2/2008 9:24 AM, Zinger wrote:
> Hi All,
>
> I want to execute a shell script which returns the response time from
> a URL (using wget(?)). Can this be done through a shell script and
> how? The OS in linux.

"time" may be all you need:

$ time curl http://www.gnu.org/index.html >/dev/null 2>&1

real    0m0.304s
user    0m0.030s
sys     0m0.077s

Depends what you're really looking for...

Regards,

Ed.


Report this thread to moderator Post Follow-up to this message
Old Post
Ed Morton
04-03-08 12:41 AM


Re: Measuring response time from a URL
Zinger wrote:

> Hi All,
>
> I want to execute a shell script which returns the response time from
> a URL (using wget(?)). Can this be done through a shell script and
> how? The OS in linux.

Don't know what you mean by "response time", however try this:

$ time wget your://url.here

--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.

Report this thread to moderator Post Follow-up to this message
Old Post
pk
04-03-08 12:41 AM


Re: Measuring response time from a URL
On 2008-04-02, Zinger <zmasood@gmail.com> wrote:
> Hi All,
>
> I want to execute a shell script which returns the response time from
> a URL (using wget(?)). Can this be done through a shell script and
> how? The OS in linux.
>
>
> Thanks in advance,
>
> ZM
>
time wget http://example.com/website


--
Christopher Mattern

NOTICE
Thank you for noticing this new notice
Your noticing it has been noted
And will be reported to the authorities

Report this thread to moderator Post Follow-up to this message
Old Post
Chris Mattern
04-03-08 12:41 AM


Re: Measuring response time from a URL
On Apr 2, 11:43 am, Chris Mattern <sys...@sumire.gwu.edu> wrote:
> On 2008-04-02, Zinger <zmas...@gmail.com> wrote:> Hi All,
> 
> 
> 
>
> time wgethttp://example.com/website
>
> --
>              Christopher Mattern
>
> NOTICE
> Thank you for noticing this new notice
> Your noticing it has been noted
> And will be reported to the authorities




Hi,

Thanks. As I mentioned, I am interested in how quickly the page I am
trying to get opens up. So would "time" get me the response time from
the URL? e.g. how long did the cnn.com page took to say open up (just
as in it would have opened through a browser) in the example below? If
yes then what is the value of response time? Is it 0.411seconds?

==================
time wget cnn.com
--12:07:27--  http://cnn.com/
=> `index.html'
Resolving cnn.com... 64.236.16.20, 64.236.16.52, 64.236.24.12, ...
Connecting to cnn.com[64.236.16.20]:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.cnn.com/ [following]
--12:07:27--  http://www.cnn.com/
=> `index.html'
Resolving www.cnn.com... 64.236.24.12, 64.236.29.120,
64.236.91.21, ...
Connecting to www.cnn.com[64.236.24.12]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 91,412 [text/html]

100%
 [=======================================
====================================
=======================>]
91,412       495.93K/s

12:07:27 (494.95 KB/s) - `index.html' saved [91,412/91,412]


real    0m0.411s
user    0m0.003s
sys     0m0.002s
==========================

Report this thread to moderator Post Follow-up to this message
Old Post
Zinger
04-03-08 12:41 AM


Re: Measuring response time from a URL
Zinger wrote:

> Hi,
>
> Thanks. As I mentioned, I am interested in how quickly the page I am
> trying to get opens up.
> So would "time" get me the response time from the URL? e.g. how long did
> the cnn.com page took to say open up (just as in it would have opened
> through a browser) in the example below?

So it seems you want to know the time it takes to see the page completely
loaded in your browser (thus including objects referenced by that page).
Note that his time may be different from the time needed to transfer all the
objects across the network, since some objects (eg, java applets, flash
movies) may need some time to initialize inside the browser, even when the
page is already loaded.
Also, there are other factors that affect the overall time, such as DNS
lookups.

That said, the -p option to wget may probably suit your needs. From the man
page (which you should read anyway):

-p
--page-requisites
This option causes Wget to download all the files that are necessary to
properly display a given HTML page. This includes such things as
inlined images, sounds, and referenced stylesheets.

Read the man page, especially the full description for the -p option. You
may want to use additional options, as indicated.

> If yes then what is the value of response time? Is it 0.411seconds?
>[cut]
> real    0m0.411s
> user    0m0.003s
> sys     0m0.002s
> ==========================

man time.

The elapsed time is the one listed as "real".

--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.

Report this thread to moderator Post Follow-up to this message
Old Post
pk
04-03-08 12:41 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Unix Shell Programming archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:09 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.