Sign in to follow this  
Followers 0
JonnyBeGood

Automated response time logging of a Homepage

3 posts in this topic

Hi guys,

complete new here and also new to autoit I would ask a question.

Maybe somebody can help me in a few seconds.

I want to track/log the response time of a certain Homepage

over a period of time, lets say one refresh every second minute.

The protocoll can be a simple text file like this:

2010-12-30 18:24 Responsetime: 4sec

2010-12-30 18:25 Responsetime: 6sec

2010-12-30 18:26 Responsetime: 8sec

2010-12-30 18:27 Responsetime: 4sec

2010-12-30 18:28 Responsetime: 13sec

...and so on...

Well looong time ago I programmed a bit in COBOL Ansi 85,

so the basic logic-principe is not complete unfamiliar to me.

Should be something like that...

:BEGIN

- Make IE or Firefox the focused program (propably not necessary)

- Start a Kind of TIMER

- Send F5 (for refresh), or press the button refresh whatsoever.

- Wait until "Done" is in the left bottom corner (or other depending on browser)

(Maybe there is another way to check that the browser has successfully finished loading...?)

- A Timeout would be good, e.g. 120second---> goto BEGIN and write TIMEOUT (to prevent script freezes after connection lost).

- Stop TIMER

- Print/ADD in a file: Date_Time_"Responsetime"_Timer (Something like PRINT "HALLO" >> c:/log.txt

- Reset Timer

GOTO BEGIN

Something like that. Well if somebody can provide me the

basic comands with syntax that I need, then I can

try to stich together my first autoit-Script - if its possible to

do that what I want to do in autoit. Or maybe in another language?

Any suggestions?

Best regards from munich.

Juergen

Share this post


Link to post
Share on other sites



JonnyBeGood,

First, welcome to the AutoIt forum. :x

Reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here - you will find other tutorials in the Wiki (the link is at the top of the page). There are even video tutorials on YouTube if you prefer watching to reading.

Once you have a handle on AutoIt structure and syntax, you should look in the Help file for the following functions in particular:

:BEGIN -- While

- Make IE or Firefox the focused program (propably not necessary) -- It probably will be, so WinActivate- Start a Kind of TIMER -- TimerInit

- Send F5 (for refresh), or press the button refresh whatsoever. -- Send

- Wait until "Done" is in the left bottom corner (or other depending on browser) -- _IELoadWait seems a good bet for IE. Perhaps _GUICtrlStatusBar_GetText for other browsers?

(Maybe there is another way to check that the browser has successfully finished loading...?)

- A Timeout would be good, e.g. 120second---> goto BEGIN and write TIMEOUT (to prevent script freezes after connection lost). -- _IELoadWait has it built in - use TimerDiff for other browsers

- Stop TIMER -- TimerDiff again

- Print/ADD in a file: Date_Time_"Responsetime"_Timer (Something like PRINT "HALLO" >> c:/log.txt -- FileWrite/FileWriteLine- Reset Timer -- TimerInitGOTO BEGIN -- WEnd

So, over to you. The philosophy here is based on the old saying: "Give a man a fish, you feed him for a day; give a man a net and you feed him forever". We try to be net makers and repairers, not fishmongers - so we expect you to have a go at coding something yourself first. :shifty:

Good luck - you know where we are if you run into problems, even simple ones. :P

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Not sure what the goal of your finding out the "response" time. Whether it's to test your browser or the server. I'd think doing an _InetGetSource would be sufficient for testing server/network.

If you need to test the actual rendering then you'd need to use the browser like Melba suggests above.

I hit my web servers with a script I made and it works out for me, heres the basis of what I do.

Edit : Not sure if this is a good basis, but when I get load on my web servers I see a drastic change in response times.

#include <INet.au3>

$sURL = "http://www.google.com"

HotKeySet("q", "_Terminate") ; Hit 'q' to exit the script when it's running

While 1
    $start = TimerInit()
    $sText = _InetGetSource($sURL)
    $timediff = TimerDiff($start)
    ConsoleWrite(@HOUR & Chr(58) & @MIN & Chr(58) & @SEC & Chr(58) & @MSEC & " :: Loaded webpage " & $sURL & " in " & $timediff & @CRLF)
    Sleep(120000)
WEnd

Func _Terminate()
    Exit
EndFunc
Edited by ZacUSNYR

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0