News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How many second 1 clock is?

Started by Farabi, February 15, 2009, 11:50:57 PM

Previous topic - Next topic

Farabi

Anyone know how many second 1 clock cycle is?
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

donkey

The frequency of your CPU is the number of clock cycles per second, a 1889.57 Mhz cpu has 1,889,570,000 cycles per second. Because of variations in CPUs and small fluctuations in actual frequency each CPU is different even if they are identical models so the question can only be answered on a machine by machine basis, there is no fixed answer.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

PBrennick

To amplify further ...

A counter is a general term used in programming to refer to an incrementing variable. Some systems include a high-resolution performance counter that provides high-resolution elapsed times.

If a high-resolution performance counter exists on the system, the QueryPerformanceFrequency function can be used to express the frequency, in counts per second. The value of the count is processor dependent. On some processors, for example, the count might be the cycle rate of the processor clock.
The QueryPerformanceCounter function retrieves the current value of the high-resolution performance counter (if one exists on the system). By calling this function at the beginning and end of a section of code, an application essentially uses the counter as a high-resolution timer. For example, suppose that QueryPerformanceFrequency indicates that the frequency of the high-resolution performance counter is 50,000 counts per second. If the application calls QueryPerformanceCounter immediately before and immediately after the section of code to be timed, the counter values might be 1500 counts and 3500 counts, respectively. These values would indicate that .04 seconds (2000 counts) elapsed while the code executed.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Mark Jones

To add to the above, the mathematical formula is:


  1
Frequency  =  ----------
Period

and

  1
Period     =  ----------
Freq.


So a frequency of 1889.57MHZ, when 1 is divided by this (or so-called "reciprocated"), the period is 0.000000529 seconds. So each clock cycle takes this long.

Of course, this is the minimum duration possible. Most instructions take longer than one cycle, and due to modern processor architecture, may vary considerably. This is why timing routines take many samples of a function -- to arrive at an average execution time.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

Tedd

Just to complicate things further, your processor isn't necessarily running at full speed most of the time - they can be switched to run at 1/4, 1/2, 3/4 of the full speed as required, so unless you're doing something expensive it's unlikely to be running at the rated speed.
No snowflake in an avalanche feels responsible.

PBrennick

... which is why you would set the priority to make sure the result is fairly dependable. Without setting a high priority, you run the risk of time slicing affecting your results to the point that they would make no sense.

This is fun, what we need is MichaelW to step in. He is the guy who worked this all out to a science.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Farabi

THanks, I need time to understand it.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"