Click here to Skip to main content
15,947,958 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: GetClipBoardOwner with acrobat reader Pin
Richard MacCutchan30-Apr-12 23:03
mveRichard MacCutchan30-Apr-12 23:03 
GeneralRe: GetClipBoardOwner with acrobat reader Pin
randydom1-May-12 1:23
randydom1-May-12 1:23 
GeneralRe: GetClipBoardOwner with acrobat reader Pin
Richard MacCutchan1-May-12 1:51
mveRichard MacCutchan1-May-12 1:51 
GeneralRe: GetClipBoardOwner with acrobat reader Pin
randydom1-May-12 1:58
randydom1-May-12 1:58 
GeneralRe: GetClipBoardOwner with acrobat reader Pin
Richard MacCutchan1-May-12 2:05
mveRichard MacCutchan1-May-12 2:05 
GeneralRe: GetClipBoardOwner with acrobat reader Pin
randydom1-May-12 2:22
randydom1-May-12 2:22 
QuestionRe: GetClipBoardOwner with acrobat reader Pin
David Crow1-May-12 3:49
David Crow1-May-12 3:49 
QuestionMeauring CPU time of C code in milliseconds Pin
Ron120230-Apr-12 18:18
Ron120230-Apr-12 18:18 
Hi,

I have following C code and I am trying to measure time used by CPU.

timespec time1, time2, temp_time;

   clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time1);
    long cpu_sum = 0;


    for (i = 0; i < nelements; i++) {

     cpu_sum += array[i];

    }
   clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time2);
   int borrow = 0;
   long n = time2.tv_nsec - time1.tv_nsec;
    if (n < 0) { /* nsec underflow; borrow 1 from seconds */
       n += 1000000000L;
       borrow = 1;
   }
   temp_time.tv_nsec = n;
   temp_time.tv_sec = time2.tv_sec - time1.tv_sec - borrow;
   printf(calculated sum: %d using CPU in %lld.%.9ld seconds \n",taskid, cpu_sum, (long long)temp_time.tv_sec, (long)temp_time.tv_nsec);


Just wondering how can i get time in milliseconds?
AnswerRe: Meauring CPU time of C code in milliseconds Pin
Peter_in_278030-Apr-12 18:32
professionalPeter_in_278030-Apr-12 18:32 
GeneralRe: Meauring CPU time of C code in milliseconds Pin
Ron120230-Apr-12 18:42
Ron120230-Apr-12 18:42 
AnswerRe: Meauring CPU time of C code in milliseconds Pin
Peter_in_278030-Apr-12 18:51
professionalPeter_in_278030-Apr-12 18:51 
Questionc++ win32 CreateThread, Wait, final testing Pin
jkirkerx30-Apr-12 16:54
professionaljkirkerx30-Apr-12 16:54 
QuestionRe: c++ win32 CreateThread, Wait, final testing Pin
Code-o-mat1-May-12 0:29
Code-o-mat1-May-12 0:29 
AnswerRe: c++ win32 CreateThread, Wait, final testing Pin
jkirkerx1-May-12 6:57
professionaljkirkerx1-May-12 6:57 
AnswerRe: c++ win32 CreateThread, Wait, final testing Pin
Albert Holguin1-May-12 3:46
professionalAlbert Holguin1-May-12 3:46 
GeneralRe: c++ win32 CreateThread, Wait, final testing Pin
jkirkerx1-May-12 6:59
professionaljkirkerx1-May-12 6:59 
AnswerRe: c++ win32 CreateThread, Wait, final testing Pin
Albert Holguin2-May-12 5:35
professionalAlbert Holguin2-May-12 5:35 
AnswerI've traced it down to this Pin
jkirkerx1-May-12 13:55
professionaljkirkerx1-May-12 13:55 
GeneralSolved Now Pin
jkirkerx1-May-12 17:35
professionaljkirkerx1-May-12 17:35 
AnswerRe: Solved Now Pin
Albert Holguin1-May-12 18:22
professionalAlbert Holguin1-May-12 18:22 
GeneralRe: Solved Now Pin
jkirkerx1-May-12 18:33
professionaljkirkerx1-May-12 18:33 
GeneralRe: Solved Now Pin
Albert Holguin2-May-12 5:36
professionalAlbert Holguin2-May-12 5:36 
Question[Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
_Kel_30-Apr-12 12:24
_Kel_30-Apr-12 12:24 
AnswerRe: [Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
Richard Andrew x6430-Apr-12 12:54
professionalRichard Andrew x6430-Apr-12 12:54 
GeneralRe: [Win32 C++] VirtualFreeEx() error after WriteProcessMemory() success. But not always. Pin
_Kel_30-Apr-12 13:18
_Kel_30-Apr-12 13:18 

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.