Browse Source

* use new buffered stream (eliminates need for TFastFileStream)

master
Martok 8 years ago
parent
commit
bb245d9d50
2 changed files with 11 additions and 4 deletions
  1. +9
    -3
      uutlEmbeddedProfiler.pas
  2. +2
    -1
      uutlProfilerBinaryFmt.inc

+ 9
- 3
uutlEmbeddedProfiler.pas View File

@@ -25,7 +25,7 @@ implementation
{$IFDEF PROFILER_ENABLE}

uses
Windows, Classes;
Windows, Classes, uutlStreamHelper;

type
TWriterThread = class(TThread)
@@ -220,13 +220,19 @@ end;
constructor TProfileDataFile.Create(const aFileName: string);
var
H: TPBHeader;
hh: THandle;
begin
inherited Create;
// fDF:= TFastFileStream.Create(aFileName, fmCreate);
fDF:= TFileStream.Create(aFileName, fmCreate);
fDF:= TutlPagedBufferStream.Create(TFileStream.Create(aFileName, fmCreate), 4096*64, true);
H.VersionMagic:= NtoBE(HEADER_VER_MAGIC);
H.PtrSize:= Sizeof(PtrUInt);
H.ProgramName:= ExtractFileName(ParamStr(0));
hh:= FileOpen(ParamStr(0), fmOpenRead or fmShareDenyNone);
try
H.ProgramFileSize:= FileSeek(hh, 0, soFromEnd);
finally
FileClose(hh);
end;
fDF.Write(H, sizeof(H));
end;



+ 2
- 1
uutlProfilerBinaryFmt.inc View File

@@ -3,6 +3,7 @@ type
VersionMagic: UInt32;
PtrSize: byte;
ProgramName: ShortString;
ProgramFileSize: Int64;
end;

TPBEventHeader = packed record
@@ -22,7 +23,7 @@ type
end;

const
HEADER_VER_MAGIC = $b5bd0001;
HEADER_VER_MAGIC = $b5bd0002;
PB_KIND_ENTER = $00;
PB_KIND_EXIT = $01;


Loading…
Cancel
Save