Click here to Skip to main content
15,901,035 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: List of error codes Pin
Spykraft10-Feb-06 4:18
Spykraft10-Feb-06 4:18 
QuestionRe: List of error codes Pin
David Crow10-Feb-06 4:26
David Crow10-Feb-06 4:26 
AnswerRe: List of error codes Pin
mukherjee12410-Feb-06 22:17
mukherjee12410-Feb-06 22:17 
GeneralRe: List of error codes Pin
Blake Miller13-Feb-06 4:19
Blake Miller13-Feb-06 4:19 
AnswerRe: List of error codes Pin
James R. Twine10-Feb-06 8:53
James R. Twine10-Feb-06 8:53 
AnswerRe: List of error codes Pin
Michael Dunn10-Feb-06 11:14
sitebuilderMichael Dunn10-Feb-06 11:14 
GeneralRe: List of error codes Pin
mukherjee12410-Feb-06 22:20
mukherjee12410-Feb-06 22:20 
GeneralRe: List of error codes Pin
Spykraft10-Feb-06 22:24
Spykraft10-Feb-06 22:24 
QuestionHow to hide scrollbar? Pin
Temp8310-Feb-06 3:55
Temp8310-Feb-06 3:55 
AnswerRe: How to hide scrollbar? Pin
includeh1010-Feb-06 5:42
includeh1010-Feb-06 5:42 
QuestionSpeed again Pin
hint_5410-Feb-06 3:40
hint_5410-Feb-06 3:40 
AnswerRe: Speed again Pin
toxcct10-Feb-06 3:45
toxcct10-Feb-06 3:45 
GeneralRe: Speed again Pin
hint_5410-Feb-06 3:55
hint_5410-Feb-06 3:55 
GeneralRe: Speed again Pin
hint_5410-Feb-06 4:07
hint_5410-Feb-06 4:07 
GeneralRe: Speed again Pin
David Crow10-Feb-06 4:24
David Crow10-Feb-06 4:24 
GeneralRe: Speed again Pin
hint_5410-Feb-06 4:28
hint_5410-Feb-06 4:28 
GeneralRe: Speed again Pin
David Crow10-Feb-06 4:36
David Crow10-Feb-06 4:36 
GeneralRe: Speed again Pin
Nemanja Trifunovic10-Feb-06 5:24
Nemanja Trifunovic10-Feb-06 5:24 
GeneralRe: Speed again Pin
hint_5410-Feb-06 6:24
hint_5410-Feb-06 6:24 
AnswerRe: Speed again Pin
Jim Crafton10-Feb-06 6:37
Jim Crafton10-Feb-06 6:37 
AnswerRe: Speed again Pin
Remco Hoogenboezem10-Feb-06 8:05
Remco 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
hint_5410-Feb-06 8:23 
QuestionLock files over 2Gb 64 bit Pin
hardchip10-Feb-06 3:06
hardchip10-Feb-06 3:06 
AnswerRe: Lock files over 2Gb 64 bit Pin
Bob Stanneveld10-Feb-06 3:30
Bob 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 

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.