2022年5月10日 星期二

delphi Multicore library parallel programming

 Using TTask from the Parallel Programming Library
https://docwiki.embarcadero.com › Sydney
 
TTask creates and manages interaction with instances of ITask. ITask is an interface that provides a range of methods and properties to Start, Wait, Cancel and ...
 


    System.Threading.TTask - RAD Studio API Documentation
    https://docwiki.embarcadero.com › Syste...

   
    TTask is a class managing and representing procedures that can be executed in parallel threads. An instance of TTask represents a single task or unit of ...


delphi Parallel 之TTask 初試- 程式人生
https://www.itread01.com › content
  — Clear; SetLength(TaskArray, C); for I := 0 to C - 1 do begin TaskArray[I] := TTask.Create(procedure var Id: string; begin Id := TThread.

Introducing the TTask class | Delphi GUI Programming with ...
https://subscription.packtpub.com › book
 
TTask.Run( procedure begin // Do something end ); Copy. We should recall the TThread.CreateAnonymousThread class function but a bit more abstracted.

 

https://www.codetd.com/en/article/9464576

 http://delphi.org/2015/02/parallel-for-loops/

https://github.com/MarcoDelphiBooks/ObjectPascalHandbook104

 https://grantmcdermott.com/ds4e/parallel.html

https://github.com/eStreamSoftware/delphi-ppl 



delphi CPU  affinity mask  Thread Affinity Mask


SetProcessAffinityMask - Select more than one processor?

https://stackoverflow.com/questions/9078838/setprocessaffinitymask-select-more-than-one-processor
function CombinedProcessorMask(const Processors: array of Integer): DWORD_PTR;
  i: Integer;
  Result := 0;
  for i := low(Processors) to high(Processors) do
    Result := Result or SingleProcessorMask(Processors[i]);
function ProcessorInMask(const ProcessorMask: DWORD_PTR;
  const ProcessorIndex: Integer): Boolean;
  Result := (SingleProcessorMask(ProcessorIndex) and ProcessorMask)<>0;
 

得知自己在某個cpu core 上


https://stackoverflow.com/questions/33571061/get-the-percentage-of-total-cpu-usage

Get the Percentage of Total CPU Usage

CPU 負載

https://github.com/aadamfr/Super_macro/blob/master/adCpuUsage.pas 

AdCpuUsage

 

 How to monitor CPU and network utilization

https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/mt708809(v=vs.85) 

沒有留言: