|
peterchen wrote: This blog post[^] suggests that it should be no worse than QueryPerformanceCounter, but that's not what I'm seeing.
Anyone with insights?
My translation of what you are asking:
peterchen should have asked:
QueryProcessCycleTime uses the RDTSC instruction. QueryPerformanceCounter historically also used the RDTSC instruction. Why aren't they giving similar outputs?
As you probably already know the TSC is superceeded by the HPET. There are a dozen reasons why RDTSC provides inaccurate results. The Meltdown/Spectre mitigations were probably the nail in the coffin so to speak.
The answer to your question is that QueryPerformanceCounter uses the HPET/APIC clock and QueryProcessCycleTime is still using the old rdtsc instruction.
It's apparently a huge mess, @HaroldAptroot says sometimes QueryPerformanceCounter uses HPET and sometimes it doesn't depending on whether or not the TSC is invariant.
modified 24-Jan-23 15:14pm.
|
|
|
|
|
Randor wrote: As you probably already know the TSC is superceeded by the HPET. Not actually true though, QPC is based on HPET only when necessary, which is basically if you have a CPU that does not have Invariant TSC (and you don't, unless your CPU is from the mid 2000's). QPC is based on the TSC on every reasonable computer.
|
|
|
|
|
Hmmm,
Do you know where I can find a list of processors with an invariant TSC? I see that cpuid has 80000007H to indicate support but where can I find a list of processors that support it?
|
|
|
|
|
Unfortunately I don't know of such a list and I couldn't find one either. There are lists of CPUID dumps.. not very convenient
|
|
|
|
|
Message Closed
modified 15-May-23 19:06pm.
|
|
|
|
|
The fact that C/C++ is a staticly-typed language has nothing to do with static member functions. In turn these have very little to do with static functions in general. They are just 3 different uses for the same word.
Member 14968771 wrote: If I have a C+_+ class and the function is defined as "static" - what is so different from function which is NOT defined as NOT static ?
Regular member functions have one extra hidden parameter, the "this" pointer, that points to the object on which they are called. Static member functions don't have this hidden parameter and are very much like any regular function except for some scoping rules.
"Static", like "object" and "module" are a very abused words in programming.
Mircea
|
|
|
|
|
Member 14968771 wrote: If I have a C+_+ class and the function is defined as "static" - what is so different from function which is NOT defined as NOT static ? A non-static member function is always called via an object reference. That is any call of the form:
obj.SomeMethod();
has access to all the properties of that particular instance.
But for a static method called thus:
ClassName::StaticMethod();
has no such access, and can only access static members of the class.
But I am not sure that that was your question.
Maybe some C++ learning is in order.
ps, please do not SHOUT in your messages, it is unnecessary and rude.
|
|
|
|
|
Member 14968771 wrote: will not. when used as STATIC.
Presumably you mean...
First you tried something without 'static' in place and it worked.
Second you put 'static' somewhere and now it doesn't work. The console output does not show up.
Not really a lot of information there. So the following are some possibilities for that behavior.
- You recompiled, it failed, and then when you ran something it did not find the binary. So it didn't actually run.
- You recompiled, it worked (because someone has some 'clever' code) and it failed with an exception. But you did not see that exception output or ignored it.
- You recompiled, it worked (because someone has some 'clever' code) and that other code worked. But you did not see any output because the actual method that was called, which is a different one, does not do console output.
|
|
|
|
|
Hi...
We need some program.
We are using a POS equipment. some program must be printed by POS.
before printing we need a hooking a text message from com port.
- When the program start. we must find a com port which com port is conneced with POS equipment.
- Whenever the com port is used for printing. the text message must be returened to some way.
- the way can be suggested to you. This text message will be used by another program.
|
|
|
|
|
You are describing a case where you have an existing application flow: Serial port to POS.
And you want to put monitoring place to see what that serial traffic looks like. So you don't want to replace or modify the existing code but rather just see what is happening.
So you should google for the following
windows serial port intercept
That said however I would suggest that if the POS code is under your control that the POS code itself should be modified to provide the same sort of monitoring. Log files (search for libraries) can both be used to control and collect such data.
|
|
|
|
|
Meanwhile "member" - describe your background. Still in school?
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
Message Closed
modified 15-May-23 19:06pm.
|
|
|
|
|
This should work:
for(auto& adapter : localAdapters)
{
qDebug()<< " local adapter address" << adapter.address().toString();
ui->chat_10->append( adapter.address().toString());
qDebug() << " local adapater name " << adapter.name();
ui->chat_10->append( adapter.name());
}
Mircea
|
|
|
|
|
Try (not tested)
auto localAdapters = QBluetoothLocalDevice::allDevices();
ui->chat_10->clear();
qDebug()<< " localAdapters count " << QString::number(localAdapters.count());
for (const auto & device : localAdapters)
{
qDebug()<< " local adapter address" << device.address().toString();
ui->chat_10->append( device.address().toString());
qDebug() << " local adapater name " << device.name();
ui->chat_10->append( device.name());
}
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
Message Closed
modified 15-May-23 19:06pm.
|
|
|
|
|
Better is subjective.
For example if you modify the existing code to the following line then you should continue to use the existing solution
qDebug()<< "index=" << i << " local adapter address" << localAdapters.at(index).address().toString();
|
|
|
|
|
Hi
I have been able to format all my text. via Streamin, Next thing I would like to draw is bitmap breakpoint I mean like in the visual studio debugger. I think the examples of using the richeditole interface is if you streamin SF_RTF mine was done as text SF_TEXT.
I thinking of getting the richedit DC via CWnd::GetDC and maybe draw an ellipse
I think if i draw it on the richedit itself it might misalign the rest of the text a line, then there is the option of drawing it on the side of the dialog box though when I page up and down the text I would have to erase and re-draw if anyone has any ideas how to go about this, I would appreciate it. But as I said most of the examples, I saw for drawing in richedit was streaming with SF_RTF THANKS
|
|
|
|
|
As I have stated in my question the OLE interfaace only works SF_RTF my text was streamed in SF_TEXT
I have decided to copy Visual Studio the code is probably in SF_TEXT if you look around the code there is a frame possibly a dialogbox frame the breakpoint is probably and CDC::Ellipse. bitmaps seem to have a 3d look With SF_TEXT you cann't draw in the rich edit it messes up the text. I drew on side of the adjoining dialogbox box frame what I really needed was the y coordinates got the from PosFromChar the x I can determine from the width of the dialogbox frame thank you
|
|
|
|
|
Ignore answers from that person. We are fairly sure that they are creating answers by using the AI site ChatGPT.
|
|
|
|
|
Thanks Richard’s it looks really nice wish I could post a .jpg
|
|
|
|
|
Hi
I posted this yesterday by mistake in the CLI forum, so I am reposting here. I am getting a heap corruption in my stream in function. I have a global variable, which keep count of the number of records I stream in the exception happens when the record count is 0x197e
When I insert the following code
if (nummachine == 0x000000000000196E)
__debugbreak();
and step thru the code everythibg works fine
the amount of characters i am streaming (as I said I am able to complete the process with the above code
is 0x7604d0 or 7,734480 decimal
I use the following code
RichListing->LimitText(0x780000); though the function says that is intended for RTF code
here is the stack frame when I get the exception any debugging ideas would be much appreciated.
Thank you.
ntdll.dll!RtlReportCriticalFailure() Unknown
ntdll.dll!RtlpHeapHandleError() Unknown
ntdll.dll!RtlpHpHeapHandleError() Unknown
ntdll.dll!RtlpLogHeapFailure() Unknown
ntdll.dll!RtlpHeapFindListLookupEntry() Unknown
ntdll.dll!RtlpFindEntry() Unknown
ntdll.dll!RtlpAllocateHeap() Unknown
ntdll.dll!RtlpAllocateHeapInternal() Unknown
riched20.dll!CTxtArray::AddBlock(long,long) Unknown
riched20.dll!CTxtArray::SplitBlock(long,long,long,long,int) Unknown
riched20.dll!CTxtPtr::InsertRange(long,unsigned short const *) Unknown
riched20.dll!CRchTxtPtr::ReplaceRange(long,long,unsigned short const *,class IUndoBuilder *,long,long *,unsigned long) Unknown
riched20.dll!CTxtRange::ReplaceRange(long,unsigned short const *,class IUndoBuilder *,enum SELRR,long *,unsigned long) Unknown
riched20.dll!CTxtRange::CheckLimitReplaceRange(long,unsigned short const *,int,class IUndoBuilder *,unsigned long,long *,long,int,unsigned long) Unknown
riched20.dll!CTxtRange::CleanseAndReplaceRange(long,unsigned short const *,int,class IUndoBuilder *,unsigned short *,long *,unsigned long) Unknown
riched20.dll!CLightDTEngine::ReadPlainText(class CTxtRange *,struct _editstream *,int,class IUndoBuilder *,long) Unknown
riched20.dll!CLightDTEngine::LoadFromEs(class CTxtRange *,long,struct _editstream *,int,class IUndoBuilder *) Unknown
riched20.dll!CTxtEdit::TxSendMessage(unsigned int,unsigned __int64,__int64,__int64 *) Unknown
riched20.dll!RichEditWndProc() Unknown
riched20.dll!RichEditANSIWndProc() Unknown
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!CallWindowProcAorW(__int64 ,struct HWND__ *,enum _WM_VALUE,unsigned __int64,__int64,int) Unknown
user32.dll!CallWindowProcA() Unknown
mfc140d.dll!CWnd::DefWindowProcA(unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 1100 C++
mfc140d.dll!CWnd::WindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 2100 C++
mfc140d.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 265 C++
mfc140d.dll!AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 418 C++
mfc140d.dll!AfxWndProcBase(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 299 C++
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!SendMessageWorker() Unknown
user32.dll!SendMessageInternal(struct HWND__ *,unsigned int,unsigned __int64,__int64,int) Unknown
user32.dll!SendMessageA() Unknown
> mfc140d.dll!CRichEditCtrl::StreamIn(int nFormat, _editstream & es) Line 775 C++
DriveRichEdit.exe!CProgDebug::OnInitDialog() Line 137 C++
[External Code]
DriveRichEdit.exe!CMainFrame::PROGDEBUG() Line 48 C++
[External Code]
DriveRichEdit.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 26 C++
[External Code]
|
|
|
|
|
it was a storage overlay I'll explain I had a global variable. the kept track of the number of records are but even so the exception didn't happen at that point.
I ended doing a binary search from thousands of records.
I had allocated 63 bytes assembler of storage. e,g a dc statement that defined 90
thing is the exception doesn't happen. right away its way down the road and you have no idea where those _crtcheckmemory don't really help.
|
|
|
|