Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21611 Discussions

sorting time issue

Altera_Forum
Honored Contributor II
1,087 Views

Hi, 

 

I want to calculate the time taken to sort the files alphabetically. I am using timestamp driver. In the output gives me the sorted file names but the the time taken to sort it is always zero. 

I am using DE2 board. Following is my code 

 

#include "sys/alt_timestamp.h"# include "alt_types.h"# include <stdio.h># include <string.h> //Sort() definition int main() { int i; /* loop variable */ alt_u32 time1; alt_u32 time2; alt_timestamp_start(); time1 = alt_timestamp(); //sort(); time2 = alt_timestamp(); printf("Time taken to print = %u ticks\n", (unsigned int)time2-time1); printf("Number of ticks per second = %u\n",(unsigned int)alt_timestamp_freq()); }
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
394 Views

Hello, 

 

Here are some points that I would check first : 

- Are you sure you have a timestamp component in your system ? 

- Check the value returned by alt_timestamps_start() (0 if success) 

- Which value return alt_timestamps_frequency() ? 

- the // before your sort function is just here, it is not really in your code (just to be sure) ? 

 

Jérôme
0 Kudos
Altera_Forum
Honored Contributor II
394 Views

Thanks for the reply. 

 

The problem was I have sys_clk_timer enabled in my system. I turned it off and now it is working fine. :)
0 Kudos
Reply