Click here to Skip to main content
15,885,365 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Basic C++ - can you explain the difference / function of each definition ? Pin
Graham Breach24-Jan-23 11:30
Graham Breach24-Jan-23 11:30 
AnswerRe: Basic C++ - can you explain the difference / function of each definition ? Pin
Richard MacCutchan24-Jan-23 22:26
mveRichard MacCutchan24-Jan-23 22:26 
AnswerRe: Basic C++ - can you explain the difference / function of each definition ? Pin
jschell25-Jan-23 5:08
jschell25-Jan-23 5:08 
GeneralRe: Basic C++ - can you explain the difference / function of each definition ? Pin
Richard MacCutchan25-Jan-23 5:21
mveRichard MacCutchan25-Jan-23 5:21 
AnswerRe: Basic C++ - can you explain the difference / function of each definition ? Pin
charlieg28-Jan-23 8:57
charlieg28-Jan-23 8:57 
GeneralMessage Closed Pin
29-Jan-23 3:57
Member 1496877129-Jan-23 3:57 
GeneralRe: Basic C++ - can you explain the difference / function of each definition ? Pin
charlieg1-Feb-23 4:20
charlieg1-Feb-23 4:20 
QuestionQueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
peterchen24-Jan-23 0:34
peterchen24-Jan-23 0:34 
I've tried e.g. QueryThreadCycleTime as follows:

#include <windows.h>
#include <iostream>

int main()
{

   for (int i = 0; i < 10; ++i)
   {
      uint64_t n1 = 0, n2 = 0;
      BOOL ok1 = QueryThreadCycleTime(GetCurrentThread(), &n1);
      BOOL ok2 = QueryThreadCycleTime(GetCurrentThread(), &n2);

      if (ok1 && ok2)
         std::cout << n2 - n1 << "\n";
      else
         std::cout << "n/a\n";
   }
}


Typical results are:
1036
1114
1734
748
706
670
652
716
652
666


The numbers vary widely - ok, maybe these are expensive calls - but what is the point then?
If I replace the thread cycles with process cycles, numbers get even weirder:

BOOL ok1 = QueryProcessCycleTime(GetCurrentProcess(), &n1);
BOOL ok2 = QueryProcessCycleTime(GetCurrentProcess(), &n2);


With typical results:

39666
39520
304964
145932
47486
287156
191528
208652
196176
288642




This blog post[^] suggests that it should be no worse than QueryPerformanceCounter, but that's not what I'm seeing.

Anyone with insights?


AnswerRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
Richard MacCutchan24-Jan-23 0:44
mveRichard MacCutchan24-Jan-23 0:44 
AnswerRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
CPallini24-Jan-23 2:02
mveCPallini24-Jan-23 2:02 
GeneralRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
Richard MacCutchan24-Jan-23 2:20
mveRichard MacCutchan24-Jan-23 2:20 
GeneralRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
CPallini24-Jan-23 2:32
mveCPallini24-Jan-23 2:32 
AnswerRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
Randor 24-Jan-23 3:49
professional Randor 24-Jan-23 3:49 
GeneralRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
harold aptroot24-Jan-23 8:42
harold aptroot24-Jan-23 8:42 
QuestionRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
Randor 24-Jan-23 9:06
professional Randor 24-Jan-23 9:06 
GeneralRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
harold aptroot24-Jan-23 9:26
harold aptroot24-Jan-23 9:26 
QuestionMessage Closed Pin
21-Jan-23 9:57
Member 1496877121-Jan-23 9:57 
AnswerRe: "C++ is static (language)..." Pin
Mircea Neacsu21-Jan-23 10:59
Mircea Neacsu21-Jan-23 10:59 
AnswerRe: "C++ is static (language)..." Pin
Richard MacCutchan21-Jan-23 22:06
mveRichard MacCutchan21-Jan-23 22:06 
AnswerRe: "C++ is static (language)..." Pin
jschell22-Jan-23 8:17
jschell22-Jan-23 8:17 
QuestionCan you make a serial port hooking program? Pin
Member 1590067020-Jan-23 21:07
Member 1590067020-Jan-23 21:07 
AnswerRe: Can you make a serial port hooking program? Pin
Richard MacCutchan20-Jan-23 22:10
mveRichard MacCutchan20-Jan-23 22:10 
AnswerRe: Can you make a serial port hooking program? Pin
CPallini21-Jan-23 3:00
mveCPallini21-Jan-23 3:00 
AnswerRe: Can you make a serial port hooking program? Pin
jschell22-Jan-23 8:23
jschell22-Jan-23 8:23 
AnswerRe: Can you make a serial port hooking program? Pin
charlieg28-Jan-23 8:58
charlieg28-Jan-23 8:58 

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.