Click here to Skip to main content
16,010,334 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: which is better and why??? Pin
toxcct19-Jun-06 22:37
toxcct19-Jun-06 22:37 
GeneralRe: which is better and why??? Pin
Kevin McFarlane19-Jun-06 22:44
Kevin McFarlane19-Jun-06 22:44 
AnswerRe: which is better and why??? Pin
Jörgen Sigvardsson19-Jun-06 23:43
Jörgen Sigvardsson19-Jun-06 23:43 
QuestionMultithreading question - measure time, and block code Pin
uusheikh19-Jun-06 22:07
uusheikh19-Jun-06 22:07 
AnswerRe: Multithreading question - measure time, and block code Pin
Hamid_RT19-Jun-06 22:12
Hamid_RT19-Jun-06 22:12 
GeneralRe: Multithreading question - measure time, and block code Pin
uusheikh19-Jun-06 22:22
uusheikh19-Jun-06 22:22 
AnswerRe: Multithreading question - measure time, and block code [modified] Pin
Eytukan19-Jun-06 23:04
Eytukan19-Jun-06 23:04 
AnswerRe: Multithreading question - measure time, and block code Pin
Eytukan19-Jun-06 23:17
Eytukan19-Jun-06 23:17 
Usman Ullah Sheikh wrote:
// How to measure the time Function2 takes? Function2 is multithreaded.
// Time it takes for both thread to finish,


Why not you use global variables?Unsure | :~ and update it with the last process that finishes its task?

<br />
void Function2(int *a, int *b, int *c, int count)<br />
{<br />
//QueryPerformanceCounter - start<br />
AfxBeginThread1()// for data in the range of 0 -> count/2, handled by this thread<br />

now, if the process is completed, inside the function that thread1 runs,
do your///QueryPerformanceCounter - end

AfxBeginThread2()// for data in the range of count/2 -> count
now, if the process is completed, inside the function that thread1 runs,
do your///QueryPerformanceCounter - end
}

while updating your "end" check if it has been updated by the previous process, if so, one process is already over so no need to worry, the last one you update is the resultant one. If the "end" counter is still 0, no process is yet over. So after updating it, you still need to wait. When the next process gets over it again checks if the "end" counter is 0 or not. This time it finds value inside it (since it's been updated by the previous thread) now you can be sure everything's over and 'end'- this 'start' this is the total time taken.





<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[Jig | [Dance] ]--

[My Current Status]

GeneralRe: Multithreading question - measure time, and block code Pin
uusheikh19-Jun-06 23:31
uusheikh19-Jun-06 23:31 
QuestionEnable edit control in Dialog access Enter and ESC Pin
zeus_master19-Jun-06 22:04
zeus_master19-Jun-06 22:04 
AnswerRe: Enable edit control in Dialog access Enter and ESC Pin
Hamid_RT19-Jun-06 22:09
Hamid_RT19-Jun-06 22:09 
QuestionRe: Enable edit control in Dialog access Enter and ESC Pin
zeus_master19-Jun-06 22:15
zeus_master19-Jun-06 22:15 
AnswerRe: Enable edit control in Dialog access Enter and ESC Pin
FarPointer19-Jun-06 22:10
FarPointer19-Jun-06 22:10 
AnswerRe: Enable edit control in Dialog access Enter and ESC Pin
Cedric Moonen19-Jun-06 22:12
Cedric Moonen19-Jun-06 22:12 
QuestionRe: Enable edit control in Dialog access Enter and ESC Pin
zeus_master19-Jun-06 23:00
zeus_master19-Jun-06 23:00 
AnswerRe: Enable edit control in Dialog access Enter and ESC Pin
Cedric Moonen19-Jun-06 23:08
Cedric Moonen19-Jun-06 23:08 
GeneralRe: Enable edit control in Dialog access Enter and ESC Pin
zeus_master19-Jun-06 23:39
zeus_master19-Jun-06 23:39 
GeneralRe: Enable edit control in Dialog access Enter and ESC Pin
Cedric Moonen19-Jun-06 23:47
Cedric Moonen19-Jun-06 23:47 
GeneralRe: Enable edit control in Dialog access Enter and ESC Pin
zeus_master20-Jun-06 1:54
zeus_master20-Jun-06 1:54 
AnswerRe: Enable edit control in Dialog access Enter and ESC [modified] Pin
Weiye Chen19-Jun-06 22:25
Weiye Chen19-Jun-06 22:25 
GeneralRe: Enable edit control in Dialog access Enter and ESC [modified] Pin
zeus_master19-Jun-06 22:31
zeus_master19-Jun-06 22:31 
GeneralRe: Enable edit control in Dialog access Enter and ESC Pin
Weiye Chen19-Jun-06 22:36
Weiye Chen19-Jun-06 22:36 
AnswerRe: Enable edit control in Dialog access Enter and ESC Pin
Eytukan19-Jun-06 23:21
Eytukan19-Jun-06 23:21 
QuestionRe: Enable edit control in Dialog access Enter and ESC Pin
zeus_master19-Jun-06 23:33
zeus_master19-Jun-06 23:33 
QuestionCComboBoxEx click bug Pin
jackssf19-Jun-06 21:51
jackssf19-Jun-06 21:51 

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.