AnsweredAssumed Answered

Benchmarking code in c for TigerSHARC201 Processor

Question asked by naveenkumar on Aug 25, 2009
Latest reply on Oct 2, 2009 by AndyM

hi,

 

        I am presently working on 3rd party Multi processor Board with 6 TS201 Processors. I want to caluclate the time taken for execution of my code. below is my code in which i am using clock(); function for caluclating no of clock cycles and execution time in seconds.But after the execution of code for number of times every time i am getting different timings and cycles and which is in order of second s. Please advice a solution which calulates the time and cycles

 

 

#include<stdio.h>
#include<time.h>
#include <cycles.h>
#include <cycle_count.h>
cycle_stats_t stats;
cycle_t cycle_count;
volatile clock_t clock_start;
volatile clock_t clock_stop;
double secs;
void main()
{
int i;
clock_start = clock();
/* CYCLES_INIT(stats); */

    /*CYCLES_START(stats); */

  for(i=0;i<=1000;i++)
  {
  }
  for(i=0;i<=1000;i++)
  {
  }

for(i=0;i<=1000;i++)
  {
  }
for(i=0;i<=1000;i++)
  {
  }

 

   /*CYCLES_STOP(stats);

    printf("Cycles used \n");

   CYCLES_PRINT(stats); */
  clock_stop = clock();
  secs = ((double) (clock_stop - clock_start))

           / CLOCKS_PER_SEC;

    printf("Time taken is %e seconds\n",secs);

}

 

Thanks & Regards

Naveen Kumar I

Outcomes