forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


CPU Useage
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Tue May 14, 2002 12:20 pm    Post subject: CPU Useage Reply with quote

How can I find the CPU Useage in all windows 32 bit platforms? I would
prefer to not use a dll but if needed, I will. Also, if the dll is freeware
that would be even better. Wink Thanks.

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Tue May 14, 2002 1:09 pm    Post subject: Reply with quote

Hi, Chris!

That one is a problem. I tried to do this myself - in Win9x/ME it is no problem because
the CPU usage can be read in the registry, but I'm sure that you know that already.
But the NT based Win family does not have this registry entry so it's impossible to
obtain CPU usage directly from VDS. Crying or Very sad As you mention - it will take a DLL, but I'm afraid
that it does not exist as yet (I have not seen this function in any of the DLLs that I've
looked into).
So on the bottom line: I had to give up when I tried a couple of months back, but if you
succeed, I sure would like to know.

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Tue May 14, 2002 1:18 pm    Post subject: Reply with quote

Ok, well if some Delphi programmer is interested here some Delphi source code that could help for a DLL:

-
http://www.delphipages.com/result.cfm?ID=1983

http://www.delphipages.com/result.cfm?ID=794

Ciao... Wink
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Tue May 14, 2002 4:15 pm    Post subject: Reply with quote

Yes. I do know how in 98 and 95. But, I haven't
found a way in NT, 2k and XP.
I hope someone can use Martins links and make
a dll for it.

Thanks Dr. Dread and Martin.

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Thu May 16, 2002 12:40 am    Post subject: Reply with quote

You can use the following DLL:

http://www.vdsworld.com/files/vdscpu.zip

Thanks to Alexey A. Dynnikov for the CPU Usage component (and to Marty
for referring to this component).

The DLL is free as it is. Please notice that it'll become shareware once it
becomes part of the VDSDLL.

Commands:

CPU COLLECT
For reading the CPU data. The statistics won't become updated until you
do this.

Functions:

@CPU(COUNT)
Returns the number of CPUs. Please note that this returns one more than
the actual number of CPUs on Windows 2000 (NT?).

@CPU(WINNT)
Returns 1 if running on Windows NT platform.

@CPU(USAGE,<cpu number>)
<cpu number> is zero based. The returned number is a percentage
divided by 100, so that a value of 0,101 would mean 10,1%. Note that
somehow this value sometimes is negative. In the example script I just
have it assume a value of zero percent in that case.

Have fun with it!

Tommy
Back to top
View user's profile Send private message Send e-mail Visit poster's website
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Thu May 16, 2002 2:20 am    Post subject: Reply with quote

Great! Thanks a lot Tommy!! Very Happy
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Thu May 16, 2002 10:56 am    Post subject: Reply with quote

Tommy,

I tried the VDSCpu.dll and the script you included did not work.
I get an error at line 27

Code:

%u = @cpu(USAGE,@pred(%i))


Error on external command or function.

I was messing with it for a little, and if %i is anything higher than 0
I get the error. And if I use 0 the script crashes..Humm
Any ideas?

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu May 16, 2002 11:50 am    Post subject: Reply with quote

LiquidCode wrote:

I tried the VDSCpu.dll and the script you included did not work.
I get an error at line 27

I was messing with it for a little, and if %i is anything higher than 0
I get the error. And if I use 0 the script crashes..Humm
Any ideas?


You might try to replace the bRenewbutton routine with this:
Code:

:bRenewbutton
  list clear,lCPUUsage
  cpu collect
  %%CPUcount = @cpu(count)
  if @equal(@cpu(winnt),1)
    %%CPUcount = @pred(%%CPUcount)
  end

  if @not(@greater(%c,1))
    %%text = %%CPUcount CPU
  else
    %%text = %%CPUcount CPUs
  end

  list add,lCPUUsage,%%text
  %%increment = 0
  repeat
    %%usage = @cpu(usage,%%increment)
    %%increment = @succ(%%increment)
   
    if @greater(0,%%usage)
      %%usage = 0
    end

    list add,lCPUUsage,%%increment @fmul(%%usage,100) %
  until @equal(%%increment,%%CPUcount)
  goto evloop


By the way, the DLL seems OK in Win9x but on my W2K machine I get strange readings; output values toggle between 0 and a fixed value (44%) as far as I remember. Did not try it on my XP yet.

Greetz
Dr. Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Thu May 16, 2002 12:28 pm    Post subject: Reply with quote

Oops... Embarassed Thanks... I missed that.
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Fri May 17, 2002 12:36 am    Post subject: Reply with quote

Checked this DLL out on my XP system now. Some feedback:

1. @cpu(winnt) returns 0, so the DLL does not recognize XP as being NT-based.
2. @cpu(count) still returns one processor too many, though (just like other NT versions).

Apart from that it checks out OK. Smile

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Sat May 18, 2002 5:43 am    Post subject: Reply with quote

Here's a new version:

http://www.vdsworld.com/files/vdscpu.zip

Hopefully it'll work better now, although I doubt it would fix the mentioned
0%/44% problem on Windows 2000. The @CPU(WINNT) function has been
changed to return either WIN32, WIN32S or WIN32NT, which is consistent
to the values returned by the VDSUTIL DLL.

Also a CPU DECIMALSEP,<new decimal separator> command has been added.
You should set this to the same value as set with OPTION DECIMALSEP in
VDS. Doing this may fix a bug in Chris' PCView program causing it not to work
for me.

Tommy
Back to top
View user's profile Send private message Send e-mail Visit poster's website
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Sat May 18, 2002 12:42 pm    Post subject: Reply with quote

Thanks Tommy. I'll give the new one a try.
_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Sat May 18, 2002 12:57 pm    Post subject: Reply with quote

I have updated PCView with the new version of vdscpu.dll.
Could someone test it on Windows 9x and XP for me?
It works fine on Win 2K.

http://cgs.vdsworld.com/cgi-bin/clicker.cgi?PCView.zip

Thanks

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sat May 18, 2002 5:24 pm    Post subject: Reply with quote

Works fine on WinME.

-Garrett
Back to top
View user's profile Send private message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Sat May 18, 2002 6:35 pm    Post subject: Reply with quote

Works fine on 98SE also.
_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group