- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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());
}
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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. :)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page