You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

47 lines
1.1 KiB

  1. {$ifdef __HEAD}
  2. TProfilePlainTextMMap = class(TProfileDataFile)
  3. private
  4. fDF: TFastFileStream;
  5. public
  6. constructor Create(const aFileName: string);
  7. destructor Destroy; override;
  8. procedure WriteEnter(Thread: TThreadID; When: Int64; Func, Src: String; Line: Integer); override;
  9. procedure WriteLeave(Thread: TThreadID; When: Int64); override;
  10. end;
  11. {$ELSE}
  12. { TProfilePlainTextMMap }
  13. constructor TProfilePlainTextMMap.Create(const aFileName: string);
  14. begin
  15. inherited;
  16. fDF:= TFastFileStream.Create(aFileName, fmCreate, fmShareExclusive);
  17. end;
  18. destructor TProfilePlainTextMMap.Destroy;
  19. begin
  20. FreeAndNil(fDF);
  21. inherited;
  22. end;
  23. procedure TProfilePlainTextMMap.WriteEnter(Thread: TThreadID; When: Int64; Func, Src: String; Line: Integer);
  24. var
  25. l: string;
  26. begin
  27. l:= hexStr(When, 16)+ ';'+hexStr(Thread, 4)+ ';'+Src+ ';'+IntToStr(Line)+';'+Func + #13#10;
  28. fDF.Write(l[1], Length(l));
  29. end;
  30. procedure TProfilePlainTextMMap.WriteLeave(Thread: TThreadID; When: Int64);
  31. var
  32. l: string;
  33. begin
  34. l:= hexStr(When, 16)+ ';'+hexStr(Thread, 4)+ ';'#13#10;
  35. fDF.Write(l[1], Length(l));
  36. end;
  37. {$ENDIF}