Sign in to follow this  
Followers 0
ripdad

Upload / Download Speed

19 posts in this topic

#1 ·  Posted (edited)

- Edit2 - Deleted old scripts and the ones in the thread to avoid confusion

Updated UDF with several improvements

GetNetSpeed.au3

GetNetSpeed_Example.au3

Edited by ripdad

Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites



Hmm, you know.. since thats a Performance Counter, I've been looking for some type of counter reflecting 'TCP bytes received/sent', but all there is available is 'segments per sec'. I *can* however get Network Interface bytes sent/received (counter "\Network Interface(*)\Bytes Sent/sec" for example).

(I'm using the Performance Counters UDF in my signature btw)

Share this post


Link to post
Share on other sites

hi Ascend4nt,

I found the base code in AI_Scriptomatic - then adapted it to the code above. I was looking for "something small"

to fit into a script I'm working on. It's not perfect but it works okay.

I've seen other network speed codes on the forum - but they we're a bit much, not easily adaptable or for InetGet.

I did run your Performance Counters code. Very nice. I know you put alot of work into those UDF's.

Would you do anything different with the script above? Would value your opinion.


Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

I did some performance tests, and as I had thought, the results are indeed drawn from these performance counters:

"\Network Interface(*)\Bytes Received/sec"

"\Network Interface(*)\Bytes Sent/sec"

ripdad, check out my TestPDH_NetworkUsage UDF to see how I get the network performance results. You'll see if you compare it to your UDF that it returns the same data (only, I don't do the division).

I'd like to do *Internet* Usage, but I would have to grab TCP, UDP, and maybe IP(?) counters.. and then figure out what datagrams and segments mean in terms of bytes.. or even if they are set sizes..? *shrug*

Anyway, ripdad - as far as your UDF goes, if it works for you, then go with it. I don't see a problem with it, other than a personal preference to avoid using WMI (I avoid it due to its slow speed).

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Ascend4nt,

I checked out your TestPDH_NetworkUsage UDF. I'll look more into it soon.

I ran a test with FireFox and compared speeds between the two. It seems to be on par with FF.

Although, it seems FF has a slower decay.

Since there's a 2 second delay on the function - I'm not too worried about WMI being slow on this one.

It seems to do what I wanted it to do. Thanks for your reply.

Updated 1st post

Edited by ripdad

Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

THANKS ripdad

It's really wonderful job! The downloadspeed is reasonable.But the UPload speed keeps zero. Can you help me ?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

flashlab,

I don't know what could be causing that.

Normally, download spead will be much higher than upload. ( 10 to 1 ratio or more )

-Edit-

I think Round() is truncating the string. I replaced it with StringLeft().

Edited by ripdad

Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

ripdad

I don't think trouble comes from formating data. Maybe the WMI doesn't working fine.

When there's no data transfer action(the down and up speed should keep zero or very low ),the down/upload speed display may rocket to 3 or 4 and then fall to zero as normal.

And I can't get a upload speed display which is lower than 1.00. it's really confusing

Thank you for your response

Share this post


Link to post
Share on other sites

Sorry I don't know how to edit my post

here is the picture:GIF movie

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

deleted

Edited by ripdad

Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

it seems nothing has changed. the upload speed keeps 0(not 0.00000) or larger than 4

I test on win7 OS, and it works fine.But error occured on another XP OS...

====edit1==========================================

IF I rewrite

$UNowBytes = ($obj.BytesSentPerSec - $UPStartBytes) / 1024 / 1024

to

$UNowBytes = ($obj.BytesSentPerSec + $UPStartBytes) / 1024 / 1024

the upload speed range from 0.022 to 0.025.

the error is: Line 12 Sub script uses a non-array variable

====edit2==========================================

I've read your code carefully. and I paste a modified version.Please check it~ :x

====edit3==========================================

it seems there's something wrong with my adapter, I can't get any upload data from Packet Scheduler Miniport with any tools.

GetNetSpeed.au3

Edited by flashlab

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Go to YouTube and watch a video. Let me know your findings.

It works fine here. I don't know what could be wrong if this doesn't work for you.

What operating system are you running?

-Edit-

What was the error?

Edited by ripdad

Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

Well, hmmm.

The script "assumes" that some type of value would be in $obj.BytesSentPerSec and $obj.BytesReceivedPerSec.

I didn't think it would be otherwise. That would indicate that WMI is not returning a value for $obj.BytesSentPerSec.

Guess I'll have to prepare the script for that event with something like:

If Not $UPStartBytes Then $UPStartBytes = 0

Thanks ... I'll look into it later on today.


Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

Updated first post

flashlab, Let me know if this helps.


Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

flashlab,

First of all ... you don't need to keep editing your last post to reply.

People around here might think I'm talking to a ghost! <grin>

Here's the situation:

The reason I used these ---> StringIsDigit($DnBytes) and StringIsDigit($UpBytes)

There's not supposed to be anything else other than a "positive number" from the WMI query.

I have no idea where it came from ... but I saw a "negative number" as I was testing it.

Hence, the code in the UDF that I added.

So, I have no idea why you want to do this:

If Not StringIsDigit($DnBytes) Then
    ConsoleWrite("not return a D number" & "--" & $DnBytes & @CRLF)                                        
    $DnBytes = 0
Else
    ConsoleWrite("return D as a number" & "--" & $DnBytes & @CRLF)
EndIf

I guess there's no harm .. but what is "D"?

Also, I'm not sure if you have this. But it might help to you. This is where I got the base code for the UDF.

It will show info about your network and adapters.

WMI_NetworkInfo.au3

Edited by ripdad

Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

Our discussion is not improving the code,but solving my own problem. I just don't want to use too much layout.

the program works fine on every computer except mine =@= Maybe I will choose reinstall system.

And the additional code record return value to find error. I've forgotten to remove it.

Share this post


Link to post
Share on other sites

Okay. Well, good luck with it.

I am glad I took another look at the UDF. It gave me some new ideas.

Take care.


Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

flashlab, before you go reinstalling your O/S, try my especially the Network Usage example (seen in ).

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