472,989 Members | 3,107 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,989 software developers and data experts.

CPU Speed

Is there a way to get the CPU speed (in Mhz) without using WMI? I need to
include this functionality in a program that have to work also in Windows 98
and I don't want to distributeWMI apart.
Nov 20 '05 #1
8 870
Hi,

It is in the registry

Dim myReg As RegistryKey = Registry.LocalMachine

Dim MyRegKey As RegistryKey

Dim MyVal As String

MyRegKey =
myReg.OpenSubKey("HARDWARE\DESCRIPTION\SYSTEM\Cent ralProcessor\0")

MyVal = MyRegKey.GetValue("~Mhz")

MyRegKey.Close()

txtRegistry.Text = String.Format("CPU Speed {0}", MyVal)

Ken

--------------------

"Claudio Di Flumeri" <cl***********@mtgc.net> wrote in message
news:c4*************@ID-198343.news.uni-berlin.de...
Is there a way to get the CPU speed (in Mhz) without using WMI? I need to
include this functionality in a program that have to work also in Windows 98 and I don't want to distributeWMI apart.

Nov 20 '05 #2
Hi,

It is in the registry

Dim myReg As RegistryKey = Registry.LocalMachine

Dim MyRegKey As RegistryKey

Dim MyVal As String

MyRegKey =
myReg.OpenSubKey("HARDWARE\DESCRIPTION\SYSTEM\Cent ralProcessor\0")

MyVal = MyRegKey.GetValue("~Mhz")

MyRegKey.Close()

txtRegistry.Text = String.Format("CPU Speed {0}", MyVal)

Ken

--------------------

"Claudio Di Flumeri" <cl***********@mtgc.net> wrote in message
news:c4*************@ID-198343.news.uni-berlin.de...
Is there a way to get the CPU speed (in Mhz) without using WMI? I need to
include this functionality in a program that have to work also in Windows 98 and I don't want to distributeWMI apart.

Nov 20 '05 #3
It's exactly what I do now, but unfortunately that key is not always present
in Windows 98
"Ken Tucker [MVP]" <vb***@bellsouth.net> ha scritto nel messaggio
news:eZ**************@TK2MSFTNGP11.phx.gbl...
Hi,

It is in the registry

Dim myReg As RegistryKey = Registry.LocalMachine

Dim MyRegKey As RegistryKey

Dim MyVal As String

MyRegKey =
myReg.OpenSubKey("HARDWARE\DESCRIPTION\SYSTEM\Cent ralProcessor\0")

MyVal = MyRegKey.GetValue("~Mhz")

MyRegKey.Close()

txtRegistry.Text = String.Format("CPU Speed {0}", MyVal)

Ken

--------------------

"Claudio Di Flumeri" <cl***********@mtgc.net> wrote in message
news:c4*************@ID-198343.news.uni-berlin.de...
Is there a way to get the CPU speed (in Mhz) without using WMI? I need to include this functionality in a program that have to work also in
Windows 98
and I don't want to distributeWMI apart.



Nov 20 '05 #4
It's exactly what I do now, but unfortunately that key is not always present
in Windows 98
"Ken Tucker [MVP]" <vb***@bellsouth.net> ha scritto nel messaggio
news:eZ**************@TK2MSFTNGP11.phx.gbl...
Hi,

It is in the registry

Dim myReg As RegistryKey = Registry.LocalMachine

Dim MyRegKey As RegistryKey

Dim MyVal As String

MyRegKey =
myReg.OpenSubKey("HARDWARE\DESCRIPTION\SYSTEM\Cent ralProcessor\0")

MyVal = MyRegKey.GetValue("~Mhz")

MyRegKey.Close()

txtRegistry.Text = String.Format("CPU Speed {0}", MyVal)

Ken

--------------------

"Claudio Di Flumeri" <cl***********@mtgc.net> wrote in message
news:c4*************@ID-198343.news.uni-berlin.de...
Is there a way to get the CPU speed (in Mhz) without using WMI? I need to include this functionality in a program that have to work also in
Windows 98
and I don't want to distributeWMI apart.



Nov 20 '05 #5
you could calculate it, im not sure of the exact algoritm, but if you count
how many loops you can do in a certain period of time you can determin the
frequency of the clock in the system

like in one second, how many for loops can you do at CPU process usaged 100%
take that divide it out, figure out the number of processes that occured
then something else and that equals your speed in MHz.. there is some
documents on calculating MHz speeds on google if you search for it.
"Claudio Di Flumeri" <cl***********@mtgc.net> wrote in message
news:c4*************@ID-198343.news.uni-berlin.de...
It's exactly what I do now, but unfortunately that key is not always present in Windows 98
"Ken Tucker [MVP]" <vb***@bellsouth.net> ha scritto nel messaggio
news:eZ**************@TK2MSFTNGP11.phx.gbl...
Hi,

It is in the registry

Dim myReg As RegistryKey = Registry.LocalMachine

Dim MyRegKey As RegistryKey

Dim MyVal As String

MyRegKey =
myReg.OpenSubKey("HARDWARE\DESCRIPTION\SYSTEM\Cent ralProcessor\0")

MyVal = MyRegKey.GetValue("~Mhz")

MyRegKey.Close()

txtRegistry.Text = String.Format("CPU Speed {0}", MyVal)

Ken

--------------------

"Claudio Di Flumeri" <cl***********@mtgc.net> wrote in message
news:c4*************@ID-198343.news.uni-berlin.de...
Is there a way to get the CPU speed (in Mhz) without using WMI? I need to include this functionality in a program that have to work also in

Windows
98
and I don't want to distributeWMI apart.



Nov 20 '05 #6
you could calculate it, im not sure of the exact algoritm, but if you count
how many loops you can do in a certain period of time you can determin the
frequency of the clock in the system

like in one second, how many for loops can you do at CPU process usaged 100%
take that divide it out, figure out the number of processes that occured
then something else and that equals your speed in MHz.. there is some
documents on calculating MHz speeds on google if you search for it.
"Claudio Di Flumeri" <cl***********@mtgc.net> wrote in message
news:c4*************@ID-198343.news.uni-berlin.de...
It's exactly what I do now, but unfortunately that key is not always present in Windows 98
"Ken Tucker [MVP]" <vb***@bellsouth.net> ha scritto nel messaggio
news:eZ**************@TK2MSFTNGP11.phx.gbl...
Hi,

It is in the registry

Dim myReg As RegistryKey = Registry.LocalMachine

Dim MyRegKey As RegistryKey

Dim MyVal As String

MyRegKey =
myReg.OpenSubKey("HARDWARE\DESCRIPTION\SYSTEM\Cent ralProcessor\0")

MyVal = MyRegKey.GetValue("~Mhz")

MyRegKey.Close()

txtRegistry.Text = String.Format("CPU Speed {0}", MyVal)

Ken

--------------------

"Claudio Di Flumeri" <cl***********@mtgc.net> wrote in message
news:c4*************@ID-198343.news.uni-berlin.de...
Is there a way to get the CPU speed (in Mhz) without using WMI? I need to include this functionality in a program that have to work also in

Windows
98
and I don't want to distributeWMI apart.



Nov 20 '05 #7
here is a small assembler snippit I used a few years ago. I don't know how to
compile it in VS, but it should be possible to compile this in C++ as a dll and then
call the dll from VB.NET.

JackRazz

..586p
..Model Flat ,StdCall
UNICODE=0
Extrn _wsprintfA : near
include w32.inc

..data

capt db 'CPU Test',0
format db 'CPU Speed = %lu Mhz',0
buffer db 30 dup (0)

..code

main:
xor eax,eax
rdtsc
mov ebx,eax
call Sleep, 1000
rdtsc
sub eax,ebx
sub eax,8
xor edx,edx
mov ecx,1000000
div ecx
call _wsprintfA, offset buffer, offset format, eax
call MessageBoxA, 0 ,offset buffer, offset capt, 0
call ExitProcess , 0

end main

"Claudio Di Flumeri" <cl***********@mtgc.net> wrote in message
news:c4*************@ID-198343.news.uni-berlin.de...
| Is there a way to get the CPU speed (in Mhz) without using WMI? I need to
| include this functionality in a program that have to work also in Windows 98
| and I don't want to distributeWMI apart.
|
|
Nov 20 '05 #8
here is a small assembler snippit I used a few years ago. I don't know how to
compile it in VS, but it should be possible to compile this in C++ as a dll and then
call the dll from VB.NET.

JackRazz

..586p
..Model Flat ,StdCall
UNICODE=0
Extrn _wsprintfA : near
include w32.inc

..data

capt db 'CPU Test',0
format db 'CPU Speed = %lu Mhz',0
buffer db 30 dup (0)

..code

main:
xor eax,eax
rdtsc
mov ebx,eax
call Sleep, 1000
rdtsc
sub eax,ebx
sub eax,8
xor edx,edx
mov ecx,1000000
div ecx
call _wsprintfA, offset buffer, offset format, eax
call MessageBoxA, 0 ,offset buffer, offset capt, 0
call ExitProcess , 0

end main

"Claudio Di Flumeri" <cl***********@mtgc.net> wrote in message
news:c4*************@ID-198343.news.uni-berlin.de...
| Is there a way to get the CPU speed (in Mhz) without using WMI? I need to
| include this functionality in a program that have to work also in Windows 98
| and I don't want to distributeWMI apart.
|
|
Nov 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Yang Li Ke | last post by:
Hi guys, Is it possible to know the internet speed of the visitors with php? Thanx -- Yang
8
by: Rob Ristroph | last post by:
I have tried out PHP 5 for the first time (with assistance from this group -- thanks!). The people I was working with have a site that uses lots of php objects. They are having problems with...
34
by: Jacek Generowicz | last post by:
I have a program in which I make very good use of a memoizer: def memoize(callable): cache = {} def proxy(*args): try: return cache except KeyError: return cache.setdefault(args,...
28
by: Maboroshi | last post by:
Hi I am fairly new to programming but not as such that I am a total beginner From what I understand C and C++ are faster languages than Python. Is this because of Pythons ability to operate on...
52
by: Neuruss | last post by:
It seems there are quite a few projects aimed to improve Python's speed and, therefore, eliminate its main limitation for mainstream acceptance. I just wonder what do you all think? Will Python...
7
by: YAZ | last post by:
Hello, I have a dll which do some number crunching. Performances (execution speed) are very important in my application. I use VC6 to compile the DLL. A friend of mine told me that in Visual...
6
by: Ham | last post by:
Yeah, Gotto work with my VB.Net graphic application for days, do any possible type of code optimization, check for unhandled errors and finally come up with sth that can't process 2D graphics and...
6
by: Jassim Rahma | last post by:
I want to detect the internet speed using C# to show the user on what speed he's connecting to internet?
11
by: kyosohma | last post by:
Hi, We use a script here at work that runs whenever someone logs into their machine that logs various bits of information to a database. One of those bits is the CPU's model and speed. While...
4
by: nestle | last post by:
I have DSL with a download speed of 32MB/s and an upload speed of 8MB/s(according to my ISP), and I am using a router. My upload speed is always between 8MB/s and 9MB/s(which is above the max upload...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.