فهرست منبع

Multithreads sign/block validators change on 2 cpu's

When only 2 cpu's available, will use both, otherwise will use all cpu's-1 (max of 7 cpu's)
PascalCoin 6 سال پیش
والد
کامیت
1cf3d44a19
2فایلهای تغییر یافته به همراه8 افزوده شده و 2 حذف شده
  1. 4 1
      src/core/UPCOperationsBlockValidator.pas
  2. 4 1
      src/core/UPCOperationsSignatureValidator.pas

+ 4 - 1
src/core/UPCOperationsBlockValidator.pas

@@ -160,8 +160,11 @@ begin
   if _Cpus<=0 then begin
     _Cpus := TLogicalCPUCount.GetLogicalCPUCount;
   end;
-  LMaxThreads := _Cpus-1;
+  if (_Cpus>2) then LMaxThreads := _Cpus-1
+  else LMaxThreads := _Cpus;
   if (LMaxThreads<=0) then LMaxThreads := 1;
+  if (LMaxThreads>7) then LMaxThreads := 7;
+
   LThreads := TList<TPCOperationsBlockValidatorThread>.Create;
   Try
     // Init values

+ 4 - 1
src/core/UPCOperationsSignatureValidator.pas

@@ -266,8 +266,11 @@ begin
   if _Cpus<=0 then begin
     _Cpus := TLogicalCPUCount.GetLogicalCPUCount;
   end;
-  LMaxThreads := _Cpus-1;
+  if (_Cpus>2) then LMaxThreads := _Cpus-1
+  else LMaxThreads := _Cpus;
   if (LMaxThreads<=0) then LMaxThreads := 1;
+  if (LMaxThreads>7) then LMaxThreads := 7;
+
   LThreads := TList<TPCOperationsSignatureValidatorThread>.Create;
   Try
     // Init values