Results 1 to 8 of 8

Thread: counting core cycle

  1. #1
    Join Date
    Sep 2010
    Posts
    31

    counting core cycle

    I am running windows 7 and core 2 duo processor in my Intel laptop. i want to know how many cycle the core run during the completion of one program. I even want to know is there any way to increase the number of core for my processor. Please inform me if there is any procedure or software to count core cycle.

  2. #2
    Join Date
    May 2008
    Posts
    816

    Re: counting core cycle

    You need to give the specific instruction to read the internal counter.The CPUID And RDTSC are used. counter is returned into edx:eax or rdx:rax depending on which OS you are using.
    1) CPUID instruction: This is commonly used to obtain detailed information about the system’s CPU(s)
    2) RDTSC is used to read the CPU’s internal time-stamp counter for timing and performance-measurement purposes.

  3. #3
    Join Date
    May 2008
    Posts
    698

    Re: counting core cycle

    The RDSCT instruction counts front side buss ticks multiplyed by the clock multiplier. If it doesn't do in this way the count would break during CPU power management transitions. On my laptop it seeme to adjust appropriately so as to give the appropriate CPU cycle report.This is not same for all model. I try it on my core 2 Duo desktop, here i need to disable EIST power management in order to match the speed multiplier used by RDTSC with the actual speed multiplier of the CPU.

  4. #4
    Join Date
    May 2008
    Posts
    1,205

    Re: counting core cycle

    Cores on the single socket share RDTSC generator but for multiple sockets there is no guarantee for future. All the current sockets are having BIOS implementation which synchronizes RDTSC between sockets within hundred reported cycles. You have mention that they share FSB time base then they remain synchronized.

  5. #5
    Join Date
    Sep 2005
    Posts
    1,434

    Re: counting core cycle

    I am using RDTSC to do timing of my base code. I have core i7. The following is the code to convert number of ticks to wall time. YOu are suppose to know the CPU speed.
    unsigned int64 VlcTimer::calCpuSpeed(float sleepTime /* = 1*/)
    {
    unsigned int64 t1 = RDTSC();
    Sleep(1000 * sleepTime); // Sleep for 1 second
    return (RDTSC()-t1) / sleeptime; // in Hz
    }

    #
    unsigned int64 VlcTimer::getTimeInMilliSec()
    {
    return 1000 * ((double) m_accumulator / (double) m_cpuSpeed);
    }
    This will work well for determining how long the program take to execute.

  6. #6
    Join Date
    Nov 2005
    Posts
    1,187

    Re: counting core cycle

    I read your query and the portable way to measure performance in OpenMP is with omp_get_wtime() which is based on function like gettimeofday(). I have tried this one also and it give times accurate well within 1 millisecond. It does not match RDTSC ability to give accuracy within 50-150 clock. If we compare to multiple socket then it equals to several hundreds.

  7. #7
    Join Date
    Nov 2005
    Posts
    1,187

    Re: counting core cycle

    Here is simple code which initializes the variable value and print that value.
    int main()
    {
    int a = 10;
    printf("a = %d\n",a);
    return 0;
    }
    When I run this code with AXD processor I gor 4588 cycles and when I run the same code with RVDS processor I gor 11456 cycles. Can any you give me answer why there is difference in cycle count?

  8. #8
    Join Date
    Sep 2010
    Posts
    59

    Re: counting core cycle

    You are getting different cycle count for same program for sifferent processor. What I think is that AXD (ARM946E-S Processor) configure caches as ON by default And RVDS (ARM946E-S Processor, Local Host) configures caches as off by default. Check whether the option ‘Default pagetables’ is turned ON.

Similar Threads

  1. Counting characters in Excel
    By Scooby9044 in forum Windows Software
    Replies: 1
    Last Post: 27-02-2011, 12:31 PM
  2. Active Users Counting From JSP
    By Dharamsi in forum Software Development
    Replies: 5
    Last Post: 10-02-2010, 10:46 PM
  3. Counting file extension
    By Vodka in forum Software Development
    Replies: 5
    Last Post: 23-01-2010, 02:37 PM
  4. Loop counting odd and even numbers
    By Allan.d in forum Software Development
    Replies: 3
    Last Post: 23-10-2009, 11:40 AM
  5. Help with sh script loop counting
    By Brake Fail in forum Software Development
    Replies: 3
    Last Post: 10-01-2009, 06:48 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,266,449.94668 seconds with 16 queries