Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 02 Oct 2014, 02:41
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to rdtsc ? [SOLVED]
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
SpiceGuid


Joined: 20 Mar 2008
Posts: 20

PostPosted: Sun 17 Feb 2013, 12:05    Post_subject:  How to rdtsc ? [SOLVED]
Sub_title: i wish i can print the Time Stamp Counter
 

Arrow Racy Puppy Linux 5.3 is such a great programming eco-system that i am instantly converted from Windows XP-pro SP3 Cool

Arrow Among other things i love with computers is HPC (High Performance Computing)

Arrow One achievement i am proud of (found saturday 5 november 2005) :



These are 11 levels Absolute Difference triangles Cool

Arrow For HPC purpose high precision benchmark is a must have. On windows i have always used printtsc so my benchmarks have cpu-clock accuracy. Because at this performance level almost no cpu-cycle can be wasted.

Arrow So one thing i miss is TSC Sad

Arrow However i am sure this lack can be eliminated because you will cool guys at murga-linux Cool

Idea Of course if you provide me a TSC console command then i will reward you with more amazing Absolute Difference triangles.

Edited_times_total
Back to top
View user's profile Send_private_message 
amigo

Joined: 02 Apr 2007
Posts: 2252

PostPosted: Sun 17 Feb 2013, 12:55    Post_subject:  

You can time the execution of commands very easily using the program called (what else?) 'time'.
From the command line simply type:
time command-here
Back to top
View user's profile Send_private_message 
SpiceGuid


Joined: 20 Mar 2008
Posts: 20

PostPosted: Sun 17 Feb 2013, 13:45    Post_subject:  

Ok, thanks to you.

Unfortunately the story is not over :
Arrow It seems to me you overlook the HPC problems.
Arrow The time is a MHz-dependant information. Moreover cpu frequency can scale up or down. So time is just an inaccurate performance measurement.
Arrow The TSC is a MHz-independant information.
Arrow More importantly, i have a need to access clock information while the program is progressing, not only when it is terminated. The motivation is the program is so loooooooong hence it displays certain progress information. The time when a certain computation step occurs really matters.
Arrow I need to know if the program will terminate after the sun explodes or before i turn 50 Wink It makes a huge difference, isn't it ? The time command will not tell me that information. Or it will tell it long after i am died Rolling Eyes

Conclusion : i still have a need to display the cpu TSC.

Edit: i finally wrote the code myself, just have to test it

Code:
// gcc -o rdtsc rdtsc.c
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>

static __inline__ uint64_t rdtsc(void)
{
   uint32_t a, d;
   asm("cpuid");
   asm volatile("rdtsc" : "=a" (a), "=d" (d));
   return (((uint64_t)a) | (((uint64_t)d) << 32));
}

int main()
{
   uint64_t clock;
   clock = rdtsc();
   printf("%llu\n",clock);
   return 0;
}
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0470s ][ Queries: 12 (0.0051s) ][ GZIP on ]