Click here to Skip to main content
15,890,506 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Overwrite data in cell in excel Pin
CPallini24-Nov-08 7:30
mveCPallini24-Nov-08 7:30 
Questiondownload the files in FTP server Pin
AnithaSubramani24-Nov-08 2:31
AnithaSubramani24-Nov-08 2:31 
AnswerRe: download the files in FTP server Pin
Hamid_RT24-Nov-08 2:36
Hamid_RT24-Nov-08 2:36 
AnswerRe: download the files in FTP server Pin
Ahmed Charfeddine24-Nov-08 3:02
Ahmed Charfeddine24-Nov-08 3:02 
GeneralRe: download the files in FTP server Pin
Ahmed Charfeddine24-Nov-08 3:04
Ahmed Charfeddine24-Nov-08 3:04 
AnswerRe: download the files in FTP server Pin
Randor 24-Nov-08 3:22
professional Randor 24-Nov-08 3:22 
QuestionMeasuring the thread running duration. Pin
Ahmed Charfeddine24-Nov-08 2:14
Ahmed Charfeddine24-Nov-08 2:14 
AnswerRe: Measuring the thread running duration. Pin
Roger Stoltz24-Nov-08 3:05
Roger Stoltz24-Nov-08 3:05 
hINTModuleState wrote:
I found this wrong after a simple test where I measured the time using QPC between a simple ::Sleep operation and found it equal to the exact value passed as parameter to ::Sleep.


Well, it's wrong but not for the reasons you think since your test doesn't do what you seem to think it does.
::Sleep() is a busy-wait, which means that it's continuously asking "are we there yet" consuming CPU time, or in other words "burning MIPS".
Thus your measurement would be correct; i.e. you thread has in fact been running for the same amount of time as you've instructed it to in the call to ::Sleep().

To make a thread "sleep" in the sense that it doesn't use any CPU time, or rather as little as possible, you should wait on a waitable timer with a call to e.g. ::WaitForSingleObject().

What you should use to measure the execution time for a thread is ::GetThreadTimes(), read more here[^].


"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown


GeneralRe: Measuring the thread running duration. Pin
Ahmed Charfeddine27-Nov-08 9:25
Ahmed Charfeddine27-Nov-08 9:25 
GeneralRe: Measuring the thread running duration. Pin
Roger Stoltz27-Nov-08 10:23
Roger Stoltz27-Nov-08 10:23 
GeneralRe: Measuring the thread running duration. Pin
Ahmed Charfeddine27-Nov-08 11:01
Ahmed Charfeddine27-Nov-08 11:01 
QuestionRe: Measuring the thread running duration. Pin
Roger Stoltz27-Nov-08 11:37
Roger Stoltz27-Nov-08 11:37 
AnswerRe: Measuring the thread running duration. Pin
Ahmed Charfeddine27-Nov-08 12:00
Ahmed Charfeddine27-Nov-08 12:00 
GeneralRe: Measuring the thread running duration. Pin
Roger Stoltz27-Nov-08 12:12
Roger Stoltz27-Nov-08 12:12 
AnswerRe: Measuring the thread running duration. [modified] Pin
akirilov24-Nov-08 4:28
akirilov24-Nov-08 4:28 
AnswerRe: Measuring the thread running duration. Pin
Roger Stoltz24-Nov-08 5:08
Roger Stoltz24-Nov-08 5:08 
QuestionHow to check if running under administrator account on Vista from MFC app? Pin
mkoroudjiev24-Nov-08 1:58
mkoroudjiev24-Nov-08 1:58 
AnswerRe: How to check if running under administrator account on Vista from MFC app? Pin
Mark Salsbery24-Nov-08 6:28
Mark Salsbery24-Nov-08 6:28 
GeneralRe: How to check if running under administrator account on Vista from MFC app? Pin
mkoroudjiev24-Nov-08 7:55
mkoroudjiev24-Nov-08 7:55 
GeneralRe: How to check if running under administrator account on Vista from MFC app? Pin
Mark Salsbery24-Nov-08 10:54
Mark Salsbery24-Nov-08 10:54 
GeneralRe: How to check if running under administrator account on Vista from MFC app? Pin
mkoroudjiev24-Nov-08 18:50
mkoroudjiev24-Nov-08 18:50 
GeneralRe: How to check if running under administrator account on Vista from MFC app? Pin
Mark Salsbery25-Nov-08 7:04
Mark Salsbery25-Nov-08 7:04 
Questioninstallation path Pin
NewVC++24-Nov-08 1:03
NewVC++24-Nov-08 1:03 
AnswerRe: installation path Pin
_AnsHUMAN_ 24-Nov-08 1:38
_AnsHUMAN_ 24-Nov-08 1:38 
AnswerRe: installation path Pin
krmed24-Nov-08 3:25
krmed24-Nov-08 3:25 

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.