Browse Source

Core: rename TLogicalCPUCount to TCPUTool

Herman Schoenfeld 6 years ago
parent
commit
61cf4d11a1

+ 6 - 6
src/core/UAccounts.pas

@@ -683,9 +683,9 @@ begin
 end;
 end;
 
 
 class function TPascalCoinProtocol.CalcSafeBoxHash(ABlocksHashBuffer: TBytesBuffer; protocol_version: Integer): TRawBytes;
 class function TPascalCoinProtocol.CalcSafeBoxHash(ABlocksHashBuffer: TBytesBuffer; protocol_version: Integer): TRawBytes;
-begin
-  // If No buffer to hash is because it's fist block... so use Genesis: CT_Genesis_Magic_String_For_Old_Block_Hash
-  if (ABlocksHashBuffer.Length=0) then Result := TPCSafebox.InitialSafeboxHash
+begin
+  // If No buffer to hash is because it's fist block... so use Genesis: CT_Genesis_Magic_String_For_Old_Block_Hash
+  if (ABlocksHashBuffer.Length=0) then Result := TPCSafebox.InitialSafeboxHash
   else begin
   else begin
 
 
     // Protection
     // Protection
@@ -2715,7 +2715,7 @@ Var
 begin
 begin
   LPCOperationsBlockValidator := Nil;
   LPCOperationsBlockValidator := Nil;
   if checkAll then begin
   if checkAll then begin
-    LUseMultiThreadOperationsBlockValidator := TLogicalCPUCount.GetLogicalCPUCount>1;
+    LUseMultiThreadOperationsBlockValidator := TCPUTool.GetLogicalCPUCount>1;
   end else LUseMultiThreadOperationsBlockValidator := False;
   end else LUseMultiThreadOperationsBlockValidator := False;
   If Assigned(FPreviousSafeBox) then Raise Exception.Create('Cannot loadSafeBoxFromStream on a Safebox in a Separate chain');
   If Assigned(FPreviousSafeBox) then Raise Exception.Create('Cannot loadSafeBoxFromStream on a Safebox in a Separate chain');
   if (previousCheckedSafebox = Self) then previousCheckedSafebox := Nil; // Protection
   if (previousCheckedSafebox = Self) then previousCheckedSafebox := Nil; // Protection
@@ -2892,11 +2892,11 @@ begin
               Exit;
               Exit;
             end;
             end;
             if LValidatedOPPending>0 then begin
             if LValidatedOPPending>0 then begin
-              if (Assigned(progressNotify)) and ((TPlatform.GetElapsedMilliseconds(tc)>=500)) then begin
+              if (Assigned(progressNotify)) and ((TPlatform.GetElapsedMilliseconds(tc)>=500)) then begin
                 tc := TPlatform.GetTickCount;
                 tc := TPlatform.GetTickCount;
                 progressNotify(Self,Format('Validating OperationBlock info %d/%d',[LValidatedOPOk,LValidatedOPOk+LValidatedOPPending]),LValidatedOPOk,LValidatedOPOk+LValidatedOPPending);
                 progressNotify(Self,Format('Validating OperationBlock info %d/%d',[LValidatedOPOk,LValidatedOPOk+LValidatedOPPending]),LValidatedOPOk,LValidatedOPOk+LValidatedOPPending);
               end else Sleep(100)
               end else Sleep(100)
-
            end;
+            end;
           until LValidatedOPPending<=0 ;
           until LValidatedOPPending<=0 ;
         end;
         end;
       finally
       finally

+ 2 - 2
src/core/UPCOperationsBlockValidator.pas

@@ -211,7 +211,7 @@ var LMultiThreadValidator : TPCOperationsBlockValidator;
   LTC : TTickCount;
   LTC : TTickCount;
 begin
 begin
   if _Cpus<=0 then begin
   if _Cpus<=0 then begin
-    _Cpus := TLogicalCPUCount.GetLogicalCPUCount;
+    _Cpus := TCPUTool.GetLogicalCPUCount;
   end;
   end;
   if _Cpus<=1 then Exit;
   if _Cpus<=1 then Exit;
   if APCOperationsCompList.Count<_Cpus then Exit;   // If less than cpus, no need for multithreading...
   if APCOperationsCompList.Count<_Cpus then Exit;   // If less than cpus, no need for multithreading...
@@ -261,7 +261,7 @@ begin
   FErrorsList.Clear;
   FErrorsList.Clear;
 
 
   if _Cpus<=0 then begin
   if _Cpus<=0 then begin
-    _Cpus := TLogicalCPUCount.GetLogicalCPUCount;
+    _Cpus := TCPUTool.GetLogicalCPUCount;
   end;
   end;
   if (_Cpus>2) then LMaxThreads := _Cpus-1
   if (_Cpus>2) then LMaxThreads := _Cpus-1
   else LMaxThreads := _Cpus;
   else LMaxThreads := _Cpus;

+ 4 - 4
src/core/UPCOperationsSignatureValidator.pas

@@ -125,7 +125,7 @@ var
   LTC : TTickCount;
   LTC : TTickCount;
 begin
 begin
   if _Cpus<=0 then begin
   if _Cpus<=0 then begin
-    _Cpus := TLogicalCPUCount.GetLogicalCPUCount;
+    _Cpus := TCPUTool.GetLogicalCPUCount;
   end;
   end;
   if _Cpus<=1 then Exit;
   if _Cpus<=1 then Exit;
 
 
@@ -154,7 +154,7 @@ var LList : TList<TPCOperation>;
   LTC : TTickCount;
   LTC : TTickCount;
 begin
 begin
   if _Cpus<=0 then begin
   if _Cpus<=0 then begin
-    _Cpus := TLogicalCPUCount.GetLogicalCPUCount;
+    _Cpus := TCPUTool.GetLogicalCPUCount;
   end;
   end;
   if _Cpus<=1 then Exit;
   if _Cpus<=1 then Exit;
 
 
@@ -192,7 +192,7 @@ var LMultiThreadValidator : TPCOperationsSignatureValidator;
   LList : TList<TPCOperation>;
   LList : TList<TPCOperation>;
 begin
 begin
   if _Cpus<=0 then begin
   if _Cpus<=0 then begin
-    _Cpus := TLogicalCPUCount.GetLogicalCPUCount;
+    _Cpus := TCPUTool.GetLogicalCPUCount;
   end;
   end;
   if _Cpus<=1 then Exit;
   if _Cpus<=1 then Exit;
   if AOperationsHashTree.OperationsCount<_Cpus then Exit;   // If less than cpus, no need for multithreading...
   if AOperationsHashTree.OperationsCount<_Cpus then Exit;   // If less than cpus, no need for multithreading...
@@ -264,7 +264,7 @@ begin
   FLastIndexOperations := -1;
   FLastIndexOperations := -1;
 
 
   if _Cpus<=0 then begin
   if _Cpus<=0 then begin
-    _Cpus := TLogicalCPUCount.GetLogicalCPUCount;
+    _Cpus := TCPUTool.GetLogicalCPUCount;
   end;
   end;
   if (_Cpus>2) then LMaxThreads := _Cpus-1
   if (_Cpus>2) then LMaxThreads := _Cpus-1
   else LMaxThreads := _Cpus;
   else LMaxThreads := _Cpus;

+ 2 - 2
src/core/UPoolMinerThreads.pas

@@ -710,7 +710,7 @@ end;
 
 
 function TCPUDeviceThread.MinerDeviceName: String;
 function TCPUDeviceThread.MinerDeviceName: String;
 begin
 begin
-  Result := 'CPU miner with '+inttostr(FCPUs)+' ('+inttostr(TLogicalCPUCount.GetLogicalCPUCount())+' CPU''s available)';
+  Result := 'CPU miner with '+inttostr(FCPUs)+' ('+inttostr(TCPUTool.GetLogicalCPUCount())+' CPU''s available)';
 end;
 end;
 
 
 procedure TCPUDeviceThread.SetCPUs(AValue: Integer);
 procedure TCPUDeviceThread.SetCPUs(AValue: Integer);
@@ -718,7 +718,7 @@ begin
   if FCPUs=AValue then Exit;
   if FCPUs=AValue then Exit;
   FCPUs:=AValue;
   FCPUs:=AValue;
   if FCPUs<0 then FCPUs := 0;
   if FCPUs<0 then FCPUs := 0;
-  if (FCPUs>TLogicalCPUCount.GetLogicalCPUCount()) And (TLogicalCPUCount.GetLogicalCPUCount()>0) then FCPUs := TLogicalCPUCount.GetLogicalCPUCount();
+  if (FCPUs>TCPUTool.GetLogicalCPUCount()) And (TCPUTool.GetLogicalCPUCount()>0) then FCPUs := TCPUTool.GetLogicalCPUCount();
   CheckCPUs;
   CheckCPUs;
 end;
 end;
 
 

+ 0 - 3
src/core/USettings.pas

@@ -381,9 +381,6 @@ initialization
 finalization
 finalization
   if Assigned(TSettings.FAppParams) then
   if Assigned(TSettings.FAppParams) then
     FreeAndNil(TSettings.FAppParams);
     FreeAndNil(TSettings.FAppParams);
-  if Assigned(TSettings.FOnChanged) then
-    FreeAndNil(TSettings.FOnChanged);
-
 end.
 end.