A coworker noticed, that when starting a thread based equivalent of [WayBack] TTimer Class (which cannot be used in services as it depends on the VCL), then sometimes the laptop fans would spin up.
What basically happened was that for certain combinations of Enabled and Interval the Execute would loop burning 100% of one CPU core.
With 3 or more – sometimes 2 – of these threads active on a 4+4 core (4 are hyper-threaded), the processor fan would start to spin like madness.
Finding the solution was somewhat easy too:
Process Explorer would show the thread IDs burning the most CPU cycles
Delphi shows the Thread IDs in the Thread Status pane (if they are named, the ID is at the end of the name in parenthesis)
At around Delphi 2010, you can Freeze or Thaw threads. This allows you to debug only a single thread by freezing all others.
Focussing on one thread, allowed a close inspection of the loop, quickly finding the actual cause and repairing it.
MADExcept and Eurekalog are good products (and there is a JVCL tool as well). If you run your app in the IDE, you get the stack there – but for now, you need to acquire a third party package to get it runtime.I don’t disagree with the wish for a basic call stack tool, that works cross platform, but it would affect third party developers.
Whats the problem? You attach handlers to Exception.GetExceptionStackInfoProc, GetStackInfoStringProc and ` and just call a function that grabs the map or td32 info and generates the callstack – if you don’t want to spend any money for a high quality tool like madExcept (can even use it for free for non commercial use!) then use JclDebug.pas
And it taught me about this by madshi (of MADExcept fame):
DebugEngine is a collection of utils related to debug stuff (stack trace, CPU registers snaphot, debug info,…). Basically, I started to write a commercial error log plugin for Delphi, then I noticed that my internal framework got bigger and bigger. So I decided to share it with the community in hope it will be useful.
And there is the JCL ExceptDlg.pas which is quite easy to use: just add it anywhere to your project and the global exception handler will show you a stack trace provided you have a .MAP file or .TDS file (which contains TD32 symbol information) in the same directory as your .EXE.
–jeroen
Example code:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
I had this warning (which is actually an error: you cannot continue as pressing OK would get you the same warning over and over again) during AQTime installation a while ago:
---------------------------
WARNING !
---------------------------
Setup has detected AQtimerunning on your computer. You must close the application and press OK to continue.
Press Cancel to abort installation.
---------------------------
OK Cancel
---------------------------
It did successfully extract the AQtime.msi before bailing out
The fix (from SmartBear support) was remarkably simple, so I was surprised I could not find it online:
If your downloaded, saved AQtime installation package is named AQtime.exe, rename it: (ex: AQtime850.exe and you should then be able to complete the installation process.
So basically renaming AQTime.exe into AQTime850.exe allowed it to install.
Check out $(BDS)\source\cpprtl\Source\misc\unmangle.c – it contains the source code for the unmangling mechanism used by TDUMP, the debugger and the linker. (C++Builder and Delphi use the same mangling scheme.)
…
This has been around as long as BCC itself. However the file was called um.c instead of unmangle.c in older versions
The AQTimeDemo.exe is the same as the latest AQTime###.exe (functionality depends in license).
The installation from Windows Explorer sometimes fails with the below message. Installation from the command-prompt works, but you need to run it from an Administrator command-prompt:
---------------------------
E:\TEMP\AQtime824.exe
---------------------------
Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.
---------------------------
OK
---------------------------
To get going for my special case, I watched some sample videos (which I did get to work in Internet Explorer but not in Chrome forty-something):