ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/Helper/LevelDB.pas
(Generate patch)

Comparing oup/current/Helper/LevelDB.pas (file contents):
Revision 131 by alloc, Wed Mar 28 01:20:26 2007 UTC vs.
Revision 133 by alloc, Wed Mar 28 02:23:44 2007 UTC

# Line 65 | Line 65 | var
65    Stream_Body, Stream_Names:          TMemoryStream;
66    Stream_Dat, Stream_Raw, Stream_Sep: TFileStream;
67  
68 //  Data, rawdata: Tdata;
68    BeginTime, FileTime: Double;
69    Step:     Integer;
71 //  rawlist:  TRawDataList;
72 //  datlinks: TDatLinks;
70    OniImage:   TOniImage;
71    LevelID:    Integer;
72    TimeFormat: TFormatSettings;
# Line 90 | Line 87 | var
87    RawLinks:   TRawDataList;
88  
89    DatFileStream, RawFileStream: TMemoryStream;
90 +
91 + // ###########################
92 +  datsum, linksum, rawsum: Int64;
93 +  freq: Int64;
94 +  tempticks1, tempticks2: Int64;
95 + // ###########################
96   const
97    Steps: Byte = 3;
98  
# Line 280 | Line 283 | begin
283    lbl_estimation.Caption := 'Estimated finishing time: unknown';
284    Application.ProcessMessages;
285  
286 +  QueryPerformanceFrequency(freq);
287 +  datsum := 0;
288 +  linksum := 0;
289 +  rawsum := 0;
290 +
291    FileTime := Time;
292    for FileID := 0 to DatHeader.Files - 1 do
293    begin
# Line 288 | Line 296 | begin
296        FilesHeader[FileID].Extension[j] := FileInfo.Extension[4 - j];
297      if FileInfo.Size > 0 then
298      begin
299 +      QueryPerformanceCounter(tempticks1);
300 +
301        FilesHeader[FileID].DataAddr := Stream_Body.Size + 8;
302        DatFileStream := TMemoryStream.Create;
303        Connection.LoadDatFile(FileID, TStream(DatFileStream));
304 <      DatFileStream.Seek(4, soFromBeginning);
304 >      DatFileStream.Seek(0, soFromBeginning);
305 >      DatFileStream.Write(FileID, 4);
306        DatFileStream.Write(LevelID, 4);
307  
308 +      QueryPerformanceCounter(tempticks2);
309 +      datsum := datsum + (tempticks2 - tempticks1);
310 +
311        DatLinks := Connection.GetDatLinks(FileID);
312        if Length(DatLinks) > 0 then
313        begin
# Line 308 | Line 322 | begin
322          end;
323        end;
324  
325 +      QueryPerformanceCounter(tempticks1);
326 +      linksum := linksum + (tempticks1 - tempticks2);
327 +
328        RawLinks := Connection.GetRawList(FileID);
329        if Length(RawLinks) > 0 then
330        begin
# Line 334 | Line 351 | begin
351        end;
352        DatFileStream.Seek(0, soFromBeginning);
353        Stream_Body.CopyFrom(DatFileStream, DatFileStream.Size);
354 +
355 +      QueryPerformanceCounter(tempticks2);
356 +      rawsum := rawsum + (tempticks2 - tempticks1);
357      end
358      else
359        FilesHeader[i].DataAddr := 0;
# Line 356 | Line 376 | begin
376      Application.ProcessMessages;
377    end;
378  
379 +  ShowMessage('AvgDats: ' + FloatToStr((datsum / progress.Max) / freq) + #13#10 +
380 +      'AvgLinks: ' + FloatToStr((linksum / progress.Max) / freq) + #13#10 +
381 +      'AvgRaws: ' + FloatToStr((rawsum / progress.Max) / freq)
382 +   );
383 +
384    Stream_Dat.Write(DatHeader, SizeOf(DatHeader));
385    for i := 0 to High(FilesHeader) do
386      Stream_Dat.Write(FilesHeader[i], SizeOf(FilesHeader[i]));
# Line 367 | Line 392 | begin
392    DatHeader.DataSize  := Stream_Body.Size;
393    DatHeader.NamesSize := Stream_Names.Size;
394    DatHeader.DataAddr  := Stream_Dat.Size;
395 +
396    Stream_Body.Seek(0, soFromBeginning);
397    Stream_Dat.CopyFrom(Stream_Body, Stream_Body.Size);
398    DatHeader.NamesAddr := Stream_Dat.Size;

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)