To clock a processor..

This is a discussion on To clock a processor.. within the Windows Programming forums, part of the Platform Specific Boards category; I know this post belongs on the plain ol' C++ board, but my posts dissappear on that board! (no mistake). ...

  1. #1
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    905

    To clock a processor..

    I know this post belongs on the plain ol' C++ board, but my posts dissappear on that board! (no mistake).
    Ok, anyways, I need to know if this program I am about to show you is accurate to clock processor speed. Is the processor really working hard?

    PHP Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <conio.h>
    #include <time.h>
    #include <iostream.h>
    int rand(void); 

    int main() 
    {
           
    time_t difference;
        
    int x 0;
        
    int y 0;
        
    int z 0;
        
    int actualZ;
        
    printf("Input the end of the range please (0 - x): x = ");
        
    cin>>z;
        
    actualZ 1;
        
    time_t StartTime time(NULL);
        while(!
    kbhit())
        {
            
    rand() %actualZ;
            
    printf("%d",x);
            
    y++;
        }
        
    time_t EndTime time(NULL);
        
    system("cls");
        
    difference EndTime StartTime;
        
    printf("A random number between 0 and %d ",z);  
        
    printf("was generated %d times ",y);
        
    printf("in %d seconds",difference);
        while(!
    kbhit());

        return 
    0

    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  2. #2
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    905
    Well, what I'm really asking is "does RAM affect the speed of processing random integers?"

    Does it?
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Outside influences on clock cycles? (clock_t)
    By rsgysel in forum C Programming
    Replies: 4
    Last Post: 01-08-2009, 05:15 PM
  2. clock program
    By bazzano in forum C Programming
    Replies: 3
    Last Post: 03-30-2007, 10:12 PM
  3. Intel syntax on MinGW ?
    By TmX in forum Tech Board
    Replies: 2
    Last Post: 01-06-2007, 08:44 AM
  4. Is this processor 64-bit?
    By ChadJohnson in forum Tech Board
    Replies: 6
    Last Post: 02-11-2006, 08:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21