Changeset 31
- Timestamp:
- Apr 30, 2016, 12:16:19 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CoolDisk.lpi
r28 r31 85 85 </Item5> 86 86 </RequiredPackages> 87 <Units Count="1 1">87 <Units Count="12"> 88 88 <Unit0> 89 89 <Filename Value="CoolDisk.lpr"/> … … 145 145 <ResourceBaseClass Value="DataModule"/> 146 146 </Unit10> 147 <Unit11> 148 <Filename Value="UFileStreamEx.pas"/> 149 <IsPartOfProject Value="True"/> 150 </Unit11> 147 151 </Units> 148 152 </ProjectOptions> -
trunk/CoolDisk.lpr
r15 r31 10 10 Forms, tachartlazaruspkg, UFormBenchmark, UProject, 11 11 UConfig, UBlockMap, UDriveScan, Common, TemplateGenerics, UFormOperation, 12 UFormProject, UFormMain, UPhysDrive, UCore ;12 UFormProject, UFormMain, UPhysDrive, UCore, UFileStreamEx; 13 13 14 14 {$R *.res} -
trunk/Form/UFormMain.lfm
r29 r31 62 62 Height = 24 63 63 Top = 179 64 Width = 10164 Width = 96 65 65 Caption = 'Sector size:' 66 66 ParentColor = False … … 86 86 Height = 24 87 87 Top = 208 88 Width = 11 988 Width = 113 89 89 Caption = 'Sector count:' 90 90 ParentColor = False … … 102 102 Height = 24 103 103 Top = 240 104 Width = 1 36104 Width = 127 105 105 Caption = 'Current sector:' 106 106 ParentColor = False … … 110 110 Height = 24 111 111 Top = 272 112 Width = 1 62112 Width = 154 113 113 Caption = 'Damaged sectors:' 114 114 ParentColor = False … … 126 126 Height = 24 127 127 Top = 300 128 Width = 1 22128 Width = 115 129 129 Caption = 'Elapsed time:' 130 130 ParentColor = False … … 142 142 Height = 24 143 143 Top = 328 144 Width = 1 42144 Width = 135 145 145 Caption = 'Estimated time:' 146 146 ParentColor = False … … 158 158 Height = 24 159 159 Top = 148 160 Width = 1 60160 Width = 153 161 161 Caption = 'Sectors per Block:' 162 162 ParentColor = False … … 182 182 Height = 24 183 183 Top = 356 184 Width = 94184 Width = 88 185 185 Caption = 'I/O speed:' 186 186 ParentColor = False … … 190 190 Height = 24 191 191 Top = 116 192 Width = 40192 Width = 38 193 193 Caption = 'Size:' 194 194 ParentColor = False … … 314 314 Height = 24 315 315 Top = 16 316 Width = 10 7316 Width = 100 317 317 Caption = 'Operations:' 318 318 ParentColor = False -
trunk/Form/UFormMain.pas
r29 r31 520 520 BasePrefixMultipliers, SBytes); 521 521 LabelSectorCount.Caption := IntToStr(Project.DriveInfo.SectorCount); 522 LabelSectorSize.Caption := IntToStr(Project.DriveInfo.SectorSize) + ' ' + SBytes;522 LabelSectorSize.Caption := PrefixMultiplier.Add(Project.DriveInfo.SectorSize, BasePrefixMultipliers, SBytes); 523 523 end else begin 524 524 LabelSize.Caption := ''; -
trunk/Form/UFormProject.lfm
r13 r31 9 9 LCLVersion = '1.7' 10 10 object SpinEditSectorSize: TSpinEdit 11 Left = 19211 Left = 224 12 12 Height = 34 13 13 Top = 152 14 14 Width = 101 15 MaxValue = 10000016 MinValue = 115 MaxValue = 63 16 OnChange = SpinEditSectorSizeChange 17 17 TabOrder = 0 18 18 Value = 1 … … 92 92 ParentColor = False 93 93 end 94 object Label5: TLabel 95 Left = 192 96 Height = 24 97 Top = 160 98 Width = 22 99 Caption = '2^' 100 ParentColor = False 101 end 102 object Label6: TLabel 103 Left = 341 104 Height = 24 105 Top = 160 106 Width = 11 107 Caption = '=' 108 ParentColor = False 109 end 94 110 end -
trunk/Form/UFormProject.pas
r15 r31 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Spin, 9 StdCtrls, UProject ;9 StdCtrls, UProject, Math; 10 10 11 11 type … … 22 22 Label3: TLabel; 23 23 Label4: TLabel; 24 Label5: TLabel; 25 Label6: TLabel; 24 26 LabelSectorCount: TLabel; 25 27 SpinEditSectorSize: TSpinEdit; 28 procedure SpinEditSectorSizeChange(Sender: TObject); 26 29 private 30 procedure UpdateSectorSize; 27 31 public 28 32 procedure Load(Project: TProject); … … 42 46 { TFormProject } 43 47 48 procedure TFormProject.SpinEditSectorSizeChange(Sender: TObject); 49 begin 50 UpdateSectorSize; 51 end; 52 53 procedure TFormProject.UpdateSectorSize; 54 begin 55 Label6.Caption := '= ' + IntToStr(Trunc(IntPower(2, SpinEditSectorSize.Value))) + ' bytes'; 56 end; 57 44 58 procedure TFormProject.Load(Project: TProject); 45 59 begin 46 60 Core.DriveList.LoadToStrings(ComboBoxDrive.Items); 47 61 EditName.Text := Project.Name; 48 SpinEditSectorSize.Value := Project.DriveInfo.SectorSize;62 SpinEditSectorSize.Value := Trunc(Log2(Project.DriveInfo.SectorSize)); 49 63 ComboBoxDrive.ItemIndex := Core.DriveList.IndexOf(Core.DriveList.FindByModel(Project.DriveInfo.Model)); 64 UpdateSectorSize; 50 65 end; 51 66 … … 53 68 begin 54 69 Project.Name := EditName.Text; 55 Project.DriveInfo.SectorSize := SpinEditSectorSize.Value;70 Project.DriveInfo.SectorSize := Trunc(IntPower(2, SpinEditSectorSize.Value)); 56 71 end; 57 72 -
trunk/Packages/Common/UPrefixMultiplier.pas
r4 r31 39 39 (ShortText: 'n'; FullText: 'nano'; Value: 1e-9), 40 40 (ShortText: 'u'; FullText: 'mikro'; Value: 1e-6), 41 (ShortText: 'm'; FullText: 'mili'; Value: 1 e-3),41 (ShortText: 'm'; FullText: 'mili'; Value: 1-3), 42 42 (ShortText: ''; FullText: ''; Value: 1e0), 43 43 (ShortText: 'k'; FullText: 'kilo'; Value: 1e3), -
trunk/UCore.lfm
r16 r31 18 18 end 19 19 object XMLConfig1: TXMLConfig 20 Filename = 'config.xml'21 20 StartEmpty = False 22 21 RootName = 'CONFIG' -
trunk/UCore.pas
r16 r31 40 40 Project := nil; 41 41 XMLConfig1.Filename := 'config.xml'; 42 Randomize; 42 43 end; 43 44 -
trunk/UDriveScan.pas
r29 r31 125 125 implementation 126 126 127 uses 128 UFileStreamEx; 129 127 130 resourcestring 128 131 SUnknownRunMode = 'Unknown run mode'; … … 177 180 function TTestStream.Write(const Buffer; Count: Longint): Longint; 178 181 begin 182 Result := 0; 179 183 end; 180 184 181 185 function TTestStream.Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; 182 186 begin 187 Result := 0; 183 188 end; 184 189 … … 293 298 F: TStream; 294 299 RealSize: Integer; 295 Buffer: array of Byte; 300 Buffer: Pointer; 301 BufferAligned: Pointer; 296 302 I: Integer; 303 Alignment: Integer; 297 304 begin 298 305 try … … 301 308 if ConfigTest then F := TTestStream.Create 302 309 else begin 310 //if Mode = rmRead then F := TFileStreamEx.Create(DriveName, fmOpenRead, [ffDirect]) 311 // else if Mode = rmWrite then F := TFileStreamEx.Create(DriveName, fmOpenReadWrite, [ffDirect]); 303 312 if Mode = rmRead then F := TFileStream.Create(DriveName, fmOpenRead) 304 313 else if Mode = rmWrite then F := TFileStream.Create(DriveName, fmOpenReadWrite); 305 314 end; 306 315 try 307 SetLength(Buffer, SectorSize); 316 Alignment := SectorSize; 317 Buffer := GetMem(SectorSize + Alignment); 318 BufferAligned := Pointer(Int64(Buffer) - (Int64(Buffer) and (Alignment - 1)) + Alignment); 308 319 if Mode = rmWrite then begin 309 320 if not WritePatternRandom then 310 FillChar(Buffer [0], Length(Buffer), WritePattern)311 else for I := 0 to Length(Buffer)- 1 do312 Buffer[I]:= Random(256);321 FillChar(BufferAligned^, SectorSize, WritePattern) 322 else for I := 0 to SectorSize - 1 do 323 PByte(Int64(BufferAligned) + I)^ := Random(256); 313 324 end; 314 325 while FSectorCurrent < SectorEnd do begin … … 317 328 DoChange; 318 329 F.Position := FSectorCurrent * SectorSize; 319 if Mode = rmRead then RealSize := F.Read(Buffer [0], SectorSize)320 else if Mode = rmWrite then RealSize := F.Write(Buffer [0], SectorSize)330 if Mode = rmRead then RealSize := F.Read(BufferAligned^, SectorSize) 331 else if Mode = rmWrite then RealSize := F.Write(BufferAligned^, SectorSize) 321 332 else raise Exception.Create(SUnknownRunMode); 322 333 finally … … 333 344 if Terminated then Break; 334 345 end; 346 FreeMem(Buffer); 335 347 finally 336 348 F.Free;
Note:
See TracChangeset
for help on using the changeset viewer.