clock tick

On most of the linux system (at least the one I have)have CLOCKS_PER_SEC set to 1 million (in bits/time.h header file)

Does this means the CPU executes 1 million assembly instructions in 1 sec ?

So this has nothing to do with if CPU speed is 2 GHz or 3 GHz etc... ??
perlperlAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

unknown_routineCommented:
This is  the implementation of the clock() function. On Linux, the clock ticks faster(than windows). It ticks 1 million times a second.(in windows you see this parameter is 1000)

This clock tick has nothing to do with the clock rate of your CPU
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
perlperlAuthor Commented:
so what does that 1 million tick mean? does it mean it is executing 1 milllion instructions in 1 sec?
0
Infinity08Commented:
No points for this please - I'm simply trying to clarify what unknown_routine already said.

The CLOCKS_PER_SEC value indicates the granularity of the value returned by the clock() function :

    http://en.cppreference.com/w/c/chrono/CLOCKS_PER_SEC

No more, no less.

This is completely unrelated to the CPU frequency, or even the hardware clock frequency. Your operating system might make use of either or both to decide what value to return from clock(), but the value of CLOCKS_PER_SEC is purely in the software domain (specifically it's defined by POSIX), and completely detached from the hardware domain.
0
sarabandeCommented:
so what does that 1 million tick mean? does it mean it is executing 1 milllion instructions in 1 sec?
to add to before comments:

the return type of clock is defined as clock_t type what is an integer type. depending on the platform and compiler it may be either 32 bit or 64 bit unsigned integer. in case of 32 bit Linux platform and CLOCKS_PER_SEC=1000000, the result is the number of microseconds since last processor start and would wrap the maximum integer every 72 minutes. at 32-bit windows and CLOCKS_PER_SEC=1000, the clock_t means milliseconds and it would overflow to zero every 50 days. note, on windows systems clock function doesn't have an accuracy better than 15 milliseconds while on Linux it is better than 0.5 milliseconds, normally. at both platforms you can switch to high performance timers (if hardware supplies some and drivers were available) which are able to synchronize on 10 MHz or better.

Sara
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.