Click here to Skip to main content
15,792,959 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 12:30
Graham Breach24-Jan-23 12:30 
AnswerRe: Basic C++ - can you explain the difference / function of each definition ? Pin
Richard MacCutchan24-Jan-23 23:26
mveRichard MacCutchan24-Jan-23 23:26 
AnswerRe: Basic C++ - can you explain the difference / function of each definition ? Pin
jschell25-Jan-23 6:08
jschell25-Jan-23 6:08 
GeneralRe: Basic C++ - can you explain the difference / function of each definition ? Pin
Richard MacCutchan25-Jan-23 6:21
mveRichard MacCutchan25-Jan-23 6:21 
AnswerRe: Basic C++ - can you explain the difference / function of each definition ? Pin
charlieg28-Jan-23 9:57
charlieg28-Jan-23 9:57 
GeneralMessage Closed Pin
29-Jan-23 4:57
Member 1496877129-Jan-23 4:57 
GeneralRe: Basic C++ - can you explain the difference / function of each definition ? Pin
charlieg1-Feb-23 5:20
charlieg1-Feb-23 5:20 
QuestionQueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
peterchen24-Jan-23 1:34
peterchen24-Jan-23 1: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 1:44
mveRichard MacCutchan24-Jan-23 1:44 
AnswerRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
CPallini24-Jan-23 3:02
mveCPallini24-Jan-23 3:02 
GeneralRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
Richard MacCutchan24-Jan-23 3:20
mveRichard MacCutchan24-Jan-23 3:20 
GeneralRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
CPallini24-Jan-23 3:32
mveCPallini24-Jan-23 3:32 
AnswerRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
Randor 24-Jan-23 4:49
professional Randor 24-Jan-23 4:49 
GeneralRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
harold aptroot24-Jan-23 9:42
harold aptroot24-Jan-23 9:42 
QuestionRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
Randor 24-Jan-23 10:06
professional Randor 24-Jan-23 10:06 
GeneralRe: QueryThreadCycleTime, QueryProcessCycleTime: what do these number mean? Pin
harold aptroot24-Jan-23 10:26
harold aptroot24-Jan-23 10:26 
QuestionMessage Closed Pin
21-Jan-23 10:57
Member 1496877121-Jan-23 10:57 
AnswerRe: "C++ is static (language)..." Pin
Mircea Neacsu21-Jan-23 11:59
Mircea Neacsu21-Jan-23 11:59 
AnswerRe: "C++ is static (language)..." Pin
Richard MacCutchan21-Jan-23 23:06
mveRichard MacCutchan21-Jan-23 23:06 
AnswerRe: "C++ is static (language)..." Pin
jschell22-Jan-23 9:17
jschell22-Jan-23 9:17 
QuestionCan you make a serial port hooking program? Pin
Member 1590067020-Jan-23 22:07
Member 1590067020-Jan-23 22:07 
AnswerRe: Can you make a serial port hooking program? Pin
Richard MacCutchan20-Jan-23 23:10
mveRichard MacCutchan20-Jan-23 23:10 
AnswerRe: Can you make a serial port hooking program? Pin
CPallini21-Jan-23 4:00
mveCPallini21-Jan-23 4:00 
AnswerRe: Can you make a serial port hooking program? Pin
jschell22-Jan-23 9:23
jschell22-Jan-23 9:23 
AnswerRe: Can you make a serial port hooking program? Pin
charlieg28-Jan-23 9:58
charlieg28-Jan-23 9: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.