Changeset 27
- Timestamp:
- Apr 6, 2016, 7:45:46 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Form/UFormMain.lfm
r25 r27 397 397 Align = alClient 398 398 BorderSpacing.Around = 4 399 object ChartSpeedLineSeries1: TLineSeries 400 LinePen.Color = clWhite 399 object ChartSpeedLineSeriesAvg: TLineSeries 400 LinePen.Color = clGreen 401 end 402 object ChartSpeedLineSeriesMin: TLineSeries 403 LinePen.Color = clBlue 404 end 405 object ChartSpeedLineSeriesMax: TLineSeries 406 LinePen.Color = clRed 401 407 end 402 408 end -
trunk/Form/UFormMain.pas
r26 r27 39 39 ButtonScan2: TButton; 40 40 ChartSpeed: TChart; 41 ChartSpeedLineSeries1: TLineSeries; 41 ChartSpeedLineSeriesAvg: TLineSeries; 42 ChartSpeedLineSeriesMin: TLineSeries; 43 ChartSpeedLineSeriesMax: TLineSeries; 42 44 ComboBoxDrive: TComboBox; 43 45 Image1: TImage; … … 540 542 ChartSpeed.BottomAxis.Range.UseMax := True; 541 543 ChartSpeed.BottomAxis.Range.Max := Length(SpeedSteps); 542 ChartSpeedLineSeries1.Clear; 544 ChartSpeedLineSeriesAvg.Clear; 545 ChartSpeedLineSeriesMin.Clear; 546 ChartSpeedLineSeriesMax.Clear; 543 547 for I := 0 to Length(SpeedSteps) - 1 do 544 if not SpeedSteps[I].Null then 545 ChartSpeedLineSeries1.AddXY(I, SpeedSteps[I].Average / (1024 * 1024)); 548 if not SpeedSteps[I].Null then begin 549 ChartSpeedLineSeriesAvg.AddXY(I, SpeedSteps[I].Average / (1024 * 1024)); 550 ChartSpeedLineSeriesMin.AddXY(I, SpeedSteps[I].Min / (1024 * 1024)); 551 ChartSpeedLineSeriesMax.AddXY(I, SpeedSteps[I].Max / (1024 * 1024)); 552 end; 546 553 end; 547 554 end; -
trunk/UDriveScan.pas
r25 r27 50 50 51 51 TSpeedValue = record 52 public 52 53 Null: Boolean; 53 54 Max: Int64; 54 55 Average: Int64; 56 Values: array of Int64; 55 57 Min: Int64; 56 58 procedure Reset; … … 132 134 133 135 procedure TSpeedValue.UpdateValue(Value: Int64); 136 var 137 Sum: Double; 138 I: Integer; 134 139 begin 135 140 if Null then begin 136 141 Min := High(Int64); 137 142 Max := Low(Int64); 138 Average := 0;143 SetLength(Values, 0); 139 144 end; 140 145 Null := False; 141 146 if Value > Max then Max := Value; 142 147 // TODO: Computer average 143 Average := Value; 148 SetLength(Values, Length(Values) + 1); 149 Values[Length(Values) - 1] := Value; 150 Sum := 0; 151 for I := 0 to Length(Values) - 1 do 152 Sum := Sum + Values[I]; 153 Average := Trunc(Sum / Length(Values)); 144 154 if Value < Min then Min := Value; 145 155 end; … … 344 354 SpeedTimeCurrent: TDateTime; 345 355 Index: Integer; 356 Value: Int64; 346 357 begin 347 358 SpeedTimeCurrent := Now; 348 359 Index := Trunc(SectorCurrent / SectorCount * SpeedStepsCount); 349 360 if Index >= Length(SpeedSteps) then Index := Length(SpeedSteps) - 1; 350 SpeedSteps[Index].UpdateValue( 351 Trunc((SectorCurrent - SectorLast) * SectorSize / ((SpeedTimeCurrent - SpeedTimeLast) / OneSecond))); 361 Value := Trunc((SectorCurrent - SectorLast) * SectorSize / ((SpeedTimeCurrent - SpeedTimeLast) / OneSecond)); 362 if Value < 0 then Value := 0; 363 SpeedSteps[Index].UpdateValue(Value); 352 364 SpeedTimeLast := SpeedTimeCurrent; 353 365 SectorLast := SectorCurrent; … … 389 401 SpeedTimer.Enabled := False; 390 402 SpeedTimer.OnTimer := SpeedTimerExecute; 391 SpeedStepsCount := 1000;403 SpeedStepsCount := 500; 392 404 SectorSize := 4096; 393 405 Terminated := True;
Note:
See TracChangeset
for help on using the changeset viewer.