The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,003 other followers

Archive for July 23rd, 2019

Laptop fan profiling, and debugging them – related to Profiling | CommitStrip

Posted by jpluimers on 2019/07/23

A while back, I posted the “profiling” CommitStrip on[WayBack] Profiling – Jeroen Wiert Pluimers – Google+. Boy how did I not know that within a week, I bumped into a “laptop fan profiling” artefact.

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.

TTimer Thread

A similar and better class is at [WayBack] multithreading – TTimerThread – Threaded timer class – Code Review Stack Exchange, based on [WayBack] timer – Using VCL TTimer in Delphi console application – Stack Overflow.

Read the rest of this entry »

Posted in Conference Topics, Conferences, Debugging, Delphi, Development, Event, Fun, Multi-Threading / Concurrency, Profiling-Performance-Measurement, Software Development | Leave a Comment »

Namespaces in Delphi – Stack Overflow

Posted by jpluimers on 2019/07/23

Blast from the past, but still relevant: [WayBackNamespaces in Delphi – Stack Overflow:

Q

Are there any practical benefits in using long unit file names like MyLib.MyUtils.pas or it is just a kind of unit name prefix?

A

Namespaces, like all identifiers, are meant to organize.

So using them, only benefits if your project gets organized in a better way. This is highly subjective matter (there have been ‘wars’ on even the most simple naming conventions!), so impossible to really answer.

[WayBack] Here is some documentation on how namespaces work in Delphi.

Note that ‘true’ namespaces (where more than one generic DLL can contribute to the same namespace; this is how namespaces function in the .NET world) are not possible in Delphi: you could go the BPL way, but that is not the same as a ‘generic DLL’. This is not a limitation of Delphi itself, but the way that native DLLs in Windows ‘work’.

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

DTW-DanWard/PowerShell-Beautifier: A whitespace reformatter and code cleaner for Windows PowerShell and PowerShell Core

Posted by jpluimers on 2019/07/23

Interesting tool: DTW-DanWard/PowerShell-Beautifier: A whitespace reformatter and code cleaner for Windows PowerShell and PowerShell Core

–jeroen

via: [WayBack] Is there a PowerShell code formatter / pretty printer? – Stack Overflow

Posted in CommandLine, Development, PowerShell, PowerShell, Scripting, Software Development | Leave a Comment »

 
%d bloggers like this: