| View previous topic :: View next topic |
| Author |
Message |
Rubes_sw Valued Contributor


Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Mon Oct 27, 2003 7:24 pm Post subject: Download Speed |
|
|
Anyone got any scripts lying around that can:
Show the speed in which a file is being downloaded.
eg. using vdsipp.dll to download the file, retreiving the transfer bytes,
How to you calculate the KB/Sec using the transfer bytes and time?
Anyone any scripts, code etc
Thanks
Nathan |
|
| Back to top |
|
 |
Vic D'Elfant Past Contributor


Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Tue Oct 28, 2003 10:33 am Post subject: |
|
|
Hmmm... how about his one:
| Code: |
#define function, internet
%%TransferredBytes_1 = @internet(http, transferredbytes, 1)
wait 1
%%TransferredBytes_2 = @internet(http, transferredbytes, 1)
%%TransferredBytes = @diff(%%TransferredBytes_2, %%TransferredBytes_1)
#--- %%TransferredBytes now holds the number of bytes tranferred in one second
%%Speed = @fdiv(%%TransferredBytes, 1000)
info Your download speed is %%Speed Kb/Sec
|
Regards ,
Vic _________________ phpBB Development Team
Last edited by Vic D'Elfant on Tue Oct 28, 2003 6:04 pm; edited 1 time in total |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Tue Oct 28, 2003 2:02 pm Post subject: |
|
|
This way you can calculate the average speed from the beginning of the download:
| Code: | #define function,internet
rem Calculate the time in seconds...
%%Starttime = @sum(@prod(@datetime(hh),3600),@prod(@datetime(nn),60),@datetime(ss))
rem Just wait a while...
wait 1
rem Calculate the time in seconds again...
%%Endtime = @sum(@prod(@datetime(hh),3600),@prod(@datetime(nn),60),@datetime(ss))
rem To make kB from bytes, you should divide it with 1024...
%%TransferredKiloBytes = @div(@internet(http, transferredbytes, 1),1024)
rem And the speed is the number of kB / the total time...
%%Speed = @fdiv(%%TransferredKiloBytes,@diff(%%Endtime,%%Starttime))
info The speed is around %%Speed kB/sec... |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
Protected Valued Contributor


Joined: 02 Jan 2001 Posts: 228 Location: Portugal
|
Posted: Tue Oct 28, 2003 8:41 pm Post subject: |
|
|
| Notice in Skit's example vic... a Kb has 1024 bytes =) Its important |
|
| Back to top |
|
 |
Vic D'Elfant Past Contributor


Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Wed Oct 29, 2003 8:21 am Post subject: |
|
|
Oops
I made the example in about two minutes and I didn't thought about that one. I should have known
Regards,
Vic _________________ phpBB Development Team |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|