Стартовый пул
This commit is contained in:
19
fwzip/delphi7/Demos/PerfomanceTest/FWZipPerfomance.dpr
Normal file
19
fwzip/delphi7/Demos/PerfomanceTest/FWZipPerfomance.dpr
Normal file
@@ -0,0 +1,19 @@
|
||||
program FWZipPerfomance;
|
||||
{$IFDEF FPC}
|
||||
{$MODE Delphi}
|
||||
{$ENDIF}
|
||||
uses
|
||||
{$IFDEF FPC}
|
||||
Interfaces,
|
||||
{$ENDIF }
|
||||
Forms,
|
||||
Unit1 in 'Unit1.pas' {Form1};
|
||||
|
||||
{$IFNDEF FPC}
|
||||
{$R *.res}
|
||||
{$ENDIF}
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
258
fwzip/delphi7/Demos/PerfomanceTest/Unit1.dfm
Normal file
258
fwzip/delphi7/Demos/PerfomanceTest/Unit1.dfm
Normal file
@@ -0,0 +1,258 @@
|
||||
object Form1: TForm1
|
||||
Left = 381
|
||||
Top = 183
|
||||
Caption = #1058#1077#1089#1090' '#1087#1088#1086#1080#1079#1074#1086#1076#1080#1090#1077#1083#1100#1085#1086#1089#1090#1080' FWZip'
|
||||
ClientHeight = 615
|
||||
ClientWidth = 562
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
DesignSize = (
|
||||
562
|
||||
615)
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object GroupBox1: TGroupBox
|
||||
Left = 8
|
||||
Top = 8
|
||||
Width = 527
|
||||
Height = 105
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
Caption = #1053#1072#1089#1090#1088#1086#1081#1082#1080' '#1089#1078#1072#1090#1080#1103
|
||||
TabOrder = 0
|
||||
DesignSize = (
|
||||
527
|
||||
105)
|
||||
object LabeledEdit1: TLabeledEdit
|
||||
Left = 16
|
||||
Top = 40
|
||||
Width = 469
|
||||
Height = 21
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
EditLabel.Width = 149
|
||||
EditLabel.Height = 13
|
||||
EditLabel.Caption = #1042#1099#1073#1077#1088#1080#1090#1077' '#1087#1072#1087#1082#1091' '#1076#1083#1103' '#1089#1078#1072#1090#1080#1103':'
|
||||
TabOrder = 0
|
||||
Text = 'D:\StroyInfo 5'
|
||||
OnChange = LabeledEdit1Change
|
||||
end
|
||||
object Button1: TButton
|
||||
Left = 491
|
||||
Top = 38
|
||||
Width = 26
|
||||
Height = 25
|
||||
Hint = #1054#1073#1079#1086#1088'...'
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = '...'
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 1
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object CheckBox1: TCheckBox
|
||||
Left = 16
|
||||
Top = 72
|
||||
Width = 145
|
||||
Height = 17
|
||||
Caption = #1064#1080#1092#1088#1086#1074#1072#1090#1100' '#1087#1088#1080' '#1089#1078#1072#1090#1080#1080
|
||||
TabOrder = 2
|
||||
OnClick = CheckBox1Click
|
||||
end
|
||||
object LabeledEdit2: TLabeledEdit
|
||||
Left = 264
|
||||
Top = 70
|
||||
Width = 172
|
||||
Height = 21
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
EditLabel.Width = 84
|
||||
EditLabel.Height = 13
|
||||
EditLabel.Caption = #1059#1082#1072#1078#1080#1090#1077' '#1087#1072#1088#1086#1083#1100
|
||||
Enabled = False
|
||||
LabelPosition = lpLeft
|
||||
TabOrder = 3
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 442
|
||||
Top = 69
|
||||
Width = 75
|
||||
Height = 25
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = #1057#1078#1072#1090#1100
|
||||
TabOrder = 4
|
||||
OnClick = Button2Click
|
||||
end
|
||||
end
|
||||
object GroupBox2: TGroupBox
|
||||
Left = 8
|
||||
Top = 128
|
||||
Width = 527
|
||||
Height = 137
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
Caption = #1053#1072#1089#1090#1088#1086#1081#1082#1080' '#1088#1072#1089#1087#1072#1082#1086#1074#1082#1080
|
||||
TabOrder = 1
|
||||
DesignSize = (
|
||||
527
|
||||
137)
|
||||
object LabeledEdit3: TLabeledEdit
|
||||
Left = 16
|
||||
Top = 40
|
||||
Width = 469
|
||||
Height = 21
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
EditLabel.Width = 171
|
||||
EditLabel.Height = 13
|
||||
EditLabel.Caption = #1042#1099#1073#1077#1088#1080#1090#1077' '#1072#1088#1093#1080#1074' '#1076#1083#1103' '#1088#1072#1089#1087#1072#1082#1086#1074#1082#1080':'
|
||||
TabOrder = 0
|
||||
OnChange = LabeledEdit3Change
|
||||
end
|
||||
object Button3: TButton
|
||||
Left = 491
|
||||
Top = 38
|
||||
Width = 26
|
||||
Height = 25
|
||||
Hint = #1054#1073#1079#1086#1088'...'
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = '...'
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 1
|
||||
OnClick = Button3Click
|
||||
end
|
||||
object CheckBox2: TCheckBox
|
||||
Left = 16
|
||||
Top = 72
|
||||
Width = 145
|
||||
Height = 17
|
||||
Caption = #1040#1088#1093#1080#1074' '#1079#1072#1096#1080#1092#1088#1086#1074#1072#1085
|
||||
TabOrder = 2
|
||||
OnClick = CheckBox2Click
|
||||
end
|
||||
object LabeledEdit4: TLabeledEdit
|
||||
Left = 264
|
||||
Top = 70
|
||||
Width = 167
|
||||
Height = 21
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
EditLabel.Width = 84
|
||||
EditLabel.Height = 13
|
||||
EditLabel.Caption = #1059#1082#1072#1078#1080#1090#1077' '#1087#1072#1088#1086#1083#1100
|
||||
Enabled = False
|
||||
LabelPosition = lpLeft
|
||||
TabOrder = 3
|
||||
end
|
||||
object Button4: TButton
|
||||
Left = 442
|
||||
Top = 68
|
||||
Width = 75
|
||||
Height = 25
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = #1056#1072#1089#1087#1072#1082#1086#1074#1072#1090#1100
|
||||
TabOrder = 4
|
||||
OnClick = Button4Click
|
||||
end
|
||||
object Button6: TButton
|
||||
Tag = 1
|
||||
Left = 442
|
||||
Top = 99
|
||||
Width = 75
|
||||
Height = 25
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = #1055#1088#1086#1074#1077#1088#1080#1090#1100
|
||||
TabOrder = 5
|
||||
OnClick = Button4Click
|
||||
end
|
||||
end
|
||||
object GroupBox3: TGroupBox
|
||||
Left = 8
|
||||
Top = 271
|
||||
Width = 527
|
||||
Height = 178
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
Caption = #1055#1088#1086#1080#1079#1074#1086#1076#1080#1090#1077#1083#1100#1085#1086#1089#1090#1100':'
|
||||
TabOrder = 2
|
||||
DesignSize = (
|
||||
527
|
||||
178)
|
||||
object Label1: TLabel
|
||||
Left = 16
|
||||
Top = 24
|
||||
Width = 163
|
||||
Height = 13
|
||||
Caption = #1058#1077#1082#1091#1097#1080#1081' '#1088#1072#1089#1093#1086#1076' '#1087#1072#1084#1103#1090#1080': 0 '#1073#1072#1081#1090
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 16
|
||||
Top = 43
|
||||
Width = 163
|
||||
Height = 13
|
||||
Caption = #1055#1080#1082#1086#1074#1099#1081' '#1088#1072#1089#1093#1086#1076' '#1087#1072#1084#1103#1090#1080': 0 '#1073#1072#1081#1090
|
||||
end
|
||||
object Label3: TLabel
|
||||
Left = 16
|
||||
Top = 62
|
||||
Width = 166
|
||||
Height = 13
|
||||
Caption = #1054#1073#1097#1077#1077' '#1082#1086#1083#1080#1095#1077#1089#1090#1074#1086' '#1101#1083#1077#1084#1077#1085#1090#1086#1074': 0'
|
||||
end
|
||||
object Label4: TLabel
|
||||
Left = 16
|
||||
Top = 81
|
||||
Width = 142
|
||||
Height = 13
|
||||
Caption = #1054#1073#1097#1077#1077' '#1088#1072#1079#1084#1077#1088' '#1101#1083#1077#1084#1077#1085#1090#1086#1074': 0'
|
||||
end
|
||||
object Label5: TLabel
|
||||
Left = 16
|
||||
Top = 109
|
||||
Width = 501
|
||||
Height = 13
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
AutoSize = False
|
||||
end
|
||||
object ProgressBar1: TProgressBar
|
||||
Left = 16
|
||||
Top = 128
|
||||
Width = 498
|
||||
Height = 17
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
TabOrder = 0
|
||||
end
|
||||
object ProgressBar2: TProgressBar
|
||||
Left = 16
|
||||
Top = 151
|
||||
Width = 498
|
||||
Height = 17
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
TabOrder = 1
|
||||
end
|
||||
object Button5: TButton
|
||||
Left = 439
|
||||
Top = 97
|
||||
Width = 75
|
||||
Height = 25
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = #1054#1089#1090#1072#1085#1086#1074#1080#1090#1100
|
||||
TabOrder = 2
|
||||
Visible = False
|
||||
OnClick = Button5Click
|
||||
end
|
||||
end
|
||||
object Memo1: TMemo
|
||||
Left = 8
|
||||
Top = 456
|
||||
Width = 527
|
||||
Height = 146
|
||||
Anchors = [akLeft, akTop, akRight, akBottom]
|
||||
ScrollBars = ssVertical
|
||||
TabOrder = 3
|
||||
end
|
||||
object OpenDialog1: TOpenDialog
|
||||
Left = 376
|
||||
Top = 224
|
||||
end
|
||||
end
|
323
fwzip/delphi7/Demos/PerfomanceTest/Unit1.pas
Normal file
323
fwzip/delphi7/Demos/PerfomanceTest/Unit1.pas
Normal file
@@ -0,0 +1,323 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ****************************************************************************
|
||||
// * Project : FWZip - FWZipPerfomance
|
||||
// * Purpose : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FWZip
|
||||
// * Author : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (Rouse_) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// * Copyright : <20> Fangorn Wizards Lab 1998 - 2023.
|
||||
// * Version : 2.0.0
|
||||
// * Home Page : http://rouse.drkb.ru
|
||||
// * Home Blog : http://alexander-bagel.blogspot.ru
|
||||
// ****************************************************************************
|
||||
// * Stable Release : http://rouse.drkb.ru/components.php#fwzip
|
||||
// * Latest Source : https://github.com/AlexanderBagel/FWZip
|
||||
// ****************************************************************************
|
||||
//
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
||||
// ftp://ftp.info-zip.org/pub/infozip/doc/appnote-iz-latest.zip
|
||||
// https://zlib.net/zlib-1.2.13.tar.gz
|
||||
// http://www.base2ti.com/
|
||||
//
|
||||
|
||||
unit Unit1;
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$MODE Delphi}
|
||||
{$ENDIF}
|
||||
|
||||
interface
|
||||
|
||||
{$WARN SYMBOL_PLATFORM OFF}
|
||||
{$WARN SYMBOL_DEPRECATED OFF}
|
||||
{$WARN UNIT_PLATFORM OFF}
|
||||
|
||||
uses
|
||||
{$IFDEF FPC}
|
||||
LCLIntf, LCLType,
|
||||
{$ELSE}
|
||||
Windows, FileCtrl,
|
||||
{$ENDIF}
|
||||
SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
FWZipWriter, FWZipReader, FWZipConsts;
|
||||
|
||||
type
|
||||
TForm1 = class(TForm)
|
||||
GroupBox1: TGroupBox;
|
||||
LabeledEdit1: TLabeledEdit;
|
||||
Button1: TButton;
|
||||
CheckBox1: TCheckBox;
|
||||
LabeledEdit2: TLabeledEdit;
|
||||
Button2: TButton;
|
||||
GroupBox2: TGroupBox;
|
||||
LabeledEdit3: TLabeledEdit;
|
||||
Button3: TButton;
|
||||
CheckBox2: TCheckBox;
|
||||
LabeledEdit4: TLabeledEdit;
|
||||
Button4: TButton;
|
||||
OpenDialog1: TOpenDialog;
|
||||
GroupBox3: TGroupBox;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
Label4: TLabel;
|
||||
ProgressBar1: TProgressBar;
|
||||
ProgressBar2: TProgressBar;
|
||||
Label5: TLabel;
|
||||
Button5: TButton;
|
||||
Button6: TButton;
|
||||
Memo1: TMemo;
|
||||
procedure CheckBox1Click(Sender: TObject);
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure LabeledEdit1Change(Sender: TObject);
|
||||
procedure Button3Click(Sender: TObject);
|
||||
procedure CheckBox2Click(Sender: TObject);
|
||||
procedure LabeledEdit3Change(Sender: TObject);
|
||||
procedure Button2Click(Sender: TObject);
|
||||
procedure Button4Click(Sender: TObject);
|
||||
procedure Button5Click(Sender: TObject);
|
||||
private
|
||||
InitialHeapSize, MaxHeapSize, AverageHeapSize: Int64;
|
||||
TotalGetHeapStatusCount: Integer;
|
||||
StopProcess: Boolean;
|
||||
procedure OnProgress(Sender: TObject; const FileName: string;
|
||||
Percent, TotalPercent: Byte; var Cancel: Boolean;
|
||||
ProgressState: TProgressState);
|
||||
procedure UpdateMemoryStatus;
|
||||
procedure SetEnabledState(Value: Boolean);
|
||||
procedure ClearZipData;
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$R *.lfm}
|
||||
{$ELSE}
|
||||
{$R *.dfm}
|
||||
{$ENDIF}
|
||||
|
||||
function GetTicks: UInt64;
|
||||
begin
|
||||
{$IFDEF FPC}
|
||||
Result := GetTickCount64;
|
||||
{$ELSE}
|
||||
Result := GetTickCount;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
var
|
||||
Dir: string;
|
||||
begin
|
||||
if SelectDirectory('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '', Dir) then
|
||||
LabeledEdit1.Text := Dir;
|
||||
end;
|
||||
|
||||
procedure TForm1.Button2Click(Sender: TObject);
|
||||
var
|
||||
I: Integer;
|
||||
TotalSize: Int64;
|
||||
Heap: THeapStatus;
|
||||
TicCount: Uint64;
|
||||
Item: TFWZipWriterItem;
|
||||
Writer: TFWZipWriter;
|
||||
begin
|
||||
Writer := TFWZipWriter.Create;
|
||||
try
|
||||
DeleteFile(
|
||||
IncludeTrailingPathDelimiter(LabeledEdit1.Text) + 'FWZipTest.zip');
|
||||
Writer.AddFolder('', LabeledEdit1.Text, '');
|
||||
TotalSize := 0;
|
||||
InitialHeapSize := 0;
|
||||
for I := 0 to Writer.Count - 1 do
|
||||
begin
|
||||
Item := Writer[I];
|
||||
Inc(TotalSize, Item.Size);
|
||||
Inc(InitialHeapSize, SizeOf(TCentralDirectoryFileHeaderEx));
|
||||
if LabeledEdit2.Text <> '' then
|
||||
begin
|
||||
Item.Password := LabeledEdit2.Text;
|
||||
Item.NeedDescriptor := True;
|
||||
end;
|
||||
end;
|
||||
Label3.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ' + IntToStr(Writer.Count);
|
||||
Label4.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ' + IntToStr(TotalSize);
|
||||
Writer.OnProgress := OnProgress;
|
||||
SetEnabledState(False);
|
||||
try
|
||||
Heap := GetHeapStatus;
|
||||
Inc(InitialHeapSize, Heap.Overhead + Heap.TotalAllocated);
|
||||
MaxHeapSize := 0;
|
||||
AverageHeapSize := 0;
|
||||
TotalGetHeapStatusCount := 0;
|
||||
StopProcess := False;
|
||||
TicCount := GetTicks;
|
||||
Writer.BuildZip(
|
||||
IncludeTrailingPathDelimiter(LabeledEdit1.Text) + 'FWZipTest.zip');
|
||||
if TotalGetHeapStatusCount = 0 then
|
||||
TotalGetHeapStatusCount := 1;
|
||||
ShowMessage(Format(
|
||||
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d <20><><EFBFBD><EFBFBD>' + sLineBreak +
|
||||
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d <20><><EFBFBD><EFBFBD>' + sLineBreak +
|
||||
'<27><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
||||
[MaxHeapSize, AverageHeapSize div TotalGetHeapStatusCount,
|
||||
(GetTicks - TicCount) div 1000]));
|
||||
finally
|
||||
SetEnabledState(True);
|
||||
end;
|
||||
finally
|
||||
Writer.Free;
|
||||
ClearZipData;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Button3Click(Sender: TObject);
|
||||
begin
|
||||
if OpenDialog1.Execute then
|
||||
LabeledEdit3.Text := OpenDialog1.FileName;
|
||||
end;
|
||||
|
||||
procedure TForm1.Button4Click(Sender: TObject);
|
||||
var
|
||||
I: Integer;
|
||||
TotalSize: Int64;
|
||||
Heap: THeapStatus;
|
||||
TicCount: Uint64;
|
||||
Path: string;
|
||||
Reader: TFWZipReader;
|
||||
begin
|
||||
{$IFDEF FPC}
|
||||
Path := '';
|
||||
{$ENDIF}
|
||||
SetLength(Path, MAX_PATH);
|
||||
Path := LabeledEdit3.Text;
|
||||
Path := ChangeFileExt(Path, '');
|
||||
Reader := TFWZipReader.Create;
|
||||
try
|
||||
Reader.LoadFromFile(LabeledEdit3.Text);
|
||||
TotalSize := 0;
|
||||
for I := 0 to Reader.Count - 1 do
|
||||
Inc(TotalSize, Reader[I].UncompressedSize);
|
||||
Label3.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ' + IntToStr(Reader.Count);
|
||||
Label4.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ' + IntToStr(TotalSize);
|
||||
Reader.OnProgress := OnProgress;
|
||||
if LabeledEdit4.Text <> '' then
|
||||
Reader.PasswordList.Add(LabeledEdit4.Text);
|
||||
SetEnabledState(False);
|
||||
try
|
||||
Heap := GetHeapStatus;
|
||||
InitialHeapSize := Heap.Overhead + Heap.TotalAllocated;
|
||||
MaxHeapSize := 0;
|
||||
AverageHeapSize := 0;
|
||||
TotalGetHeapStatusCount := 0;
|
||||
StopProcess := False;
|
||||
Memo1.Lines.Clear;
|
||||
TicCount := GetTicks;
|
||||
if TButton(Sender).Tag = 0 then
|
||||
Reader.ExtractAll(Path)
|
||||
else
|
||||
Reader.Check;
|
||||
if TotalGetHeapStatusCount = 0 then
|
||||
TotalGetHeapStatusCount := 1;
|
||||
ShowMessage(Format(
|
||||
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d <20><><EFBFBD><EFBFBD>' + sLineBreak +
|
||||
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d <20><><EFBFBD><EFBFBD>' + sLineBreak +
|
||||
'<27><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
||||
[MaxHeapSize, AverageHeapSize div TotalGetHeapStatusCount,
|
||||
(GetTicks - TicCount) div 1000]));
|
||||
finally
|
||||
SetEnabledState(True);
|
||||
end;
|
||||
finally
|
||||
Reader.Free;
|
||||
ClearZipData;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Button5Click(Sender: TObject);
|
||||
begin
|
||||
StopProcess := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.CheckBox1Click(Sender: TObject);
|
||||
begin
|
||||
LabeledEdit2.Enabled := CheckBox1.Checked;
|
||||
end;
|
||||
|
||||
procedure TForm1.CheckBox2Click(Sender: TObject);
|
||||
begin
|
||||
LabeledEdit4.Enabled := CheckBox2.Checked;
|
||||
end;
|
||||
|
||||
procedure TForm1.ClearZipData;
|
||||
begin
|
||||
Label1.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 0 <20><><EFBFBD><EFBFBD>';
|
||||
Label2.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 0 <20><><EFBFBD><EFBFBD>';
|
||||
Label3.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 0';
|
||||
Label4.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 0';
|
||||
Label5.Caption := '';
|
||||
end;
|
||||
|
||||
procedure TForm1.LabeledEdit1Change(Sender: TObject);
|
||||
begin
|
||||
Button2.Enabled := DirectoryExists(LabeledEdit1.Text);
|
||||
end;
|
||||
|
||||
procedure TForm1.LabeledEdit3Change(Sender: TObject);
|
||||
begin
|
||||
Button4.Enabled := FileExists(LabeledEdit3.Text);
|
||||
end;
|
||||
|
||||
procedure TForm1.OnProgress(Sender: TObject; const FileName: string; Percent,
|
||||
TotalPercent: Byte; var Cancel: Boolean; ProgressState: TProgressState);
|
||||
const
|
||||
p: array [TProgressState] of string = ('psStart', 'psInitialization',
|
||||
'psInProgress', 'psFinalization', 'psEnd', 'psException');
|
||||
begin
|
||||
Cancel := StopProcess;
|
||||
Label5.Caption := Format('(%d) %s', [Percent, FileName]);
|
||||
ProgressBar1.Position := Percent;
|
||||
ProgressBar2.Position := TotalPercent;
|
||||
Memo1.Lines.Add(Format('%s - %s percent %d total %d',
|
||||
[FileName, P[ProgressState], Percent, TotalPercent]));
|
||||
UpdateMemoryStatus;
|
||||
end;
|
||||
|
||||
procedure TForm1.SetEnabledState(Value: Boolean);
|
||||
begin
|
||||
Button1.Enabled := Value;
|
||||
Button2.Enabled := Value;
|
||||
Button3.Enabled := Value;
|
||||
Button4.Enabled := Value;
|
||||
Button5.Visible := not Value;
|
||||
Button6.Enabled := Value;
|
||||
LabeledEdit1.Enabled := Value;
|
||||
LabeledEdit2.Enabled := Value;
|
||||
LabeledEdit3.Enabled := Value;
|
||||
LabeledEdit4.Enabled := Value;
|
||||
CheckBox1.Enabled := Value;
|
||||
CheckBox2.Enabled := Value;
|
||||
end;
|
||||
|
||||
procedure TForm1.UpdateMemoryStatus;
|
||||
var
|
||||
HeapStatus: THeapStatus;
|
||||
HeapSize: Int64;
|
||||
begin
|
||||
HeapStatus := GetHeapStatus;
|
||||
HeapSize := HeapStatus.Overhead + HeapStatus.TotalAllocated;
|
||||
Dec(HeapSize, InitialHeapSize);
|
||||
if HeapSize > MaxHeapSize then
|
||||
MaxHeapSize := HeapSize;
|
||||
Inc(TotalGetHeapStatusCount);
|
||||
Inc(AverageHeapSize, HeapSize);
|
||||
Label1.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ' + IntToStr(HeapSize) + ' <20><><EFBFBD><EFBFBD>';
|
||||
Label2.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ' + IntToStr(MaxHeapSize) + ' <20><><EFBFBD><EFBFBD>';
|
||||
Application.ProcessMessages;
|
||||
Application.ProcessMessages;
|
||||
end;
|
||||
|
||||
end.
|
24
fwzip/delphi7/Demos/PerfomanceTest/clear.bat
Normal file
24
fwzip/delphi7/Demos/PerfomanceTest/clear.bat
Normal file
@@ -0,0 +1,24 @@
|
||||
rd /S /Q "%cd%\backup\"
|
||||
rd /S /Q "%cd%\ConverterBackup\"
|
||||
rd /S /Q "%cd%\lib\"
|
||||
rd /S /Q "%cd%\__history\"
|
||||
rd /S /Q "%cd%\__recovery\"
|
||||
del "%cd%\*.o"
|
||||
del "%cd%\*.a"
|
||||
del "%cd%\*.or"
|
||||
del "%cd%\*.lps"
|
||||
del "%cd%\*.obj"
|
||||
del "%cd%\*.exe"
|
||||
del "%cd%\*.ppu"
|
||||
del "%cd%\*.dcu"
|
||||
del "%cd%\*.log"
|
||||
del "%cd%\*.compiled"
|
||||
del "%cd%\*.cfg"
|
||||
del "%cd%\*.dof"
|
||||
del "%cd%\*.dproj.local"
|
||||
del "%cd%\*.identcache"
|
||||
del "%cd%\*.dsk"
|
||||
del "%cd%\*.skincfg"
|
||||
del "%cd%\*.bak"
|
||||
del "%cd%\*.rsm"
|
||||
del "%cd%\*.~*"
|
Reference in New Issue
Block a user