Click here to Skip to main content
15,396,106 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Speed again Pin
hint_5410-Feb-06 4:07
Memberhint_5410-Feb-06 4:07 
GeneralRe: Speed again Pin
David Crow10-Feb-06 4:24
MemberDavid Crow10-Feb-06 4:24 
GeneralRe: Speed again Pin
hint_5410-Feb-06 4:28
Memberhint_5410-Feb-06 4:28 
GeneralRe: Speed again Pin
David Crow10-Feb-06 4:36
MemberDavid Crow10-Feb-06 4:36 
GeneralRe: Speed again Pin
Nemanja Trifunovic10-Feb-06 5:24
MemberNemanja Trifunovic10-Feb-06 5:24 
GeneralRe: Speed again Pin
hint_5410-Feb-06 6:24
Memberhint_5410-Feb-06 6:24 
AnswerRe: Speed again Pin
Jim Crafton10-Feb-06 6:37
MemberJim Crafton10-Feb-06 6:37 
AnswerRe: Speed again Pin
Remco Hoogenboezem10-Feb-06 8:05
MemberRemco Hoogenboezem10-Feb-06 8:05 
Hello hint_54

When I would like to know how much time it takes to execute a particulary piece of code and this piece of code is very short I read the CPU time stamp twice. (Assuming that you are running a pentium class processor) The CPU time stamp is a 64 bits counter that runs on the same frequency as your CPU does. So with this you ll be able to measure very short times very accurate.

Oke this function is written in asm for the Borland compiler.

//---------------------------------------------------------------------------
//Read CPU time stamp
//---------------------------------------------------------------------------
__int64 CWaveIn::CPUTimeStamp(void)
{
asm
{
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
cpuid
rdtsc
}
}
//---------------------------------------------------------------------------

The instruction rdtsc reads the CPU time stamp and returns its value in register eax and edx. So you could do the folowing

ULONGLONG qwStartTime;
ULONGLONG qwStopTime;

qwStartTime=CPUTimeStamp();

//Place code here...

qwStopTime=CPUTimeStamp();

//Time?

qwStopTime-qwStartTime;

Succes Smile | :)


GeneralRe: Speed again Pin
hint_5410-Feb-06 8:23
Memberhint_5410-Feb-06 8:23 
QuestionLock files over 2Gb 64 bit Pin
hardchip10-Feb-06 3:06
Memberhardchip10-Feb-06 3:06 
AnswerRe: Lock files over 2Gb 64 bit Pin
Bob Stanneveld10-Feb-06 3:30
MemberBob Stanneveld10-Feb-06 3:30 
AnswerRe: Lock files over 2Gb 64 bit Pin
Joe Woodbury10-Feb-06 6:41
professionalJoe Woodbury10-Feb-06 6:41 
Questionwin32 error Pin
Spykraft10-Feb-06 2:56
MemberSpykraft10-Feb-06 2:56 
AnswerRe: win32 error Pin
ThatsAlok13-Feb-06 21:35
MemberThatsAlok13-Feb-06 21:35 
QuestionHOW TO ACCESS CHILDFRAME VARIABLES INTO CHILDVIEW Pin
sourabh27231810-Feb-06 2:37
Membersourabh27231810-Feb-06 2:37 
AnswerRe: HOW TO ACCESS CHILDFRAME VARIABLES INTO CHILDVIEW Pin
David Crow10-Feb-06 2:41
MemberDavid Crow10-Feb-06 2:41 
AnswerRe: HOW TO ACCESS CHILDFRAME VARIABLES INTO CHILDVIEW Pin
Maximilien10-Feb-06 2:44
MemberMaximilien10-Feb-06 2:44 
GeneralRe: HOW TO ACCESS CHILDFRAME VARIABLES INTO CHILDVIEW Pin
Jim Crafton10-Feb-06 6:38
MemberJim Crafton10-Feb-06 6:38 
AnswerRe: HOW TO ACCESS CHILDFRAME VARIABLES INTO CHILDVIEW Pin
ThatsAlok13-Feb-06 21:34
MemberThatsAlok13-Feb-06 21:34 
Questionhow to access childframe data into childview Pin
sourabh27231810-Feb-06 2:23
Membersourabh27231810-Feb-06 2:23 
AnswerRe: how to access childframe data into childview Pin
David Crow10-Feb-06 2:38
MemberDavid Crow10-Feb-06 2:38 
QuestionCrystal Report and ADO question ... Pin
Hadi Rezaee10-Feb-06 1:39
MemberHadi Rezaee10-Feb-06 1:39 
AnswerRe: Crystal Report and ADO question ... Pin
Hadi Rezaee10-Feb-06 6:09
MemberHadi Rezaee10-Feb-06 6:09 
QuestionWhen edit control is added to a dialog, application is crashing Pin
BiswaR10-Feb-06 1:21
MemberBiswaR10-Feb-06 1:21 
AnswerRe: When edit control is added to a dialog, application is crashing Pin
toxcct10-Feb-06 1:38
Membertoxcct10-Feb-06 1:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.