-
Clock Cycle Measurement
something i found interesting to share:
------------------------------------------------------------
//#put above main
extern __inline__ unsigned long long int rdtsc()
{
unsigned long long int x;
__asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
return x;
}
//#inside main
//#declare on top
unsigned long start, end;
//#before manipulation
start = rdtsc();
//#after manipulation
end = rdtsc();
//#to see output
cout << "Running Time : "
<< end - start << endl;
------------------------------------------------------------
u may try to use above partion of code to measure clock cycles needed to execute ur code. its sumthing similary to ordinary timer used in c++
-
be careful with it, some newer cpu's vary their clock speed so clock cycles measured with the time stamp register are no longer directly one to one mapped to the CPU frequency for all machines.
Similar Threads
-
By velkropie in forum Java
Replies: 5
Last Post: 03-24-2007, 11:09 AM
-
Replies: 3
Last Post: 04-14-2006, 03:44 AM
-
By k_o_bliss in forum Java
Replies: 1
Last Post: 08-16-2005, 08:44 AM
-
By Al Rest in forum vb.announcements
Replies: 0
Last Post: 06-10-2002, 03:19 AM
-
By zainorin in forum Java
Replies: 0
Last Post: 08-01-2000, 09:31 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks