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 Fri 25 Jul 2014, 18:16
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 [3 Posts]  
Author Message
SpiceGuid


Joined: 20 Mar 2008
Posts: 20

PostPosted: Sun 17 Feb 2013, 12:05    Post subject:  How to rdtsc ? [SOLVED]
Subject description: 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.

Last edited by SpiceGuid on Sun 17 Feb 2013, 22:15; edited 2 times in total
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2217

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 from previous:   Sort by:   
Page 1 of 1 [3 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0611s ][ Queries: 11 (0.0149s) ][ GZIP on ]