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.
 
 

50 lines
1.1 KiB

  1. {$ifdef __HEAD}
  2. TProfilePlainText = class(TProfileDataFile)
  3. private
  4. fDF: Textfile;
  5. fBuffer: array[0..16*1024-1] of byte;
  6. public
  7. constructor Create(const aFileName: string);
  8. destructor Destroy; override;
  9. procedure WriteEnter(Thread: TThreadID; When: Int64; Func, Src: String; Line: Integer); override;
  10. procedure WriteLeave(Thread: TThreadID; When: Int64); override;
  11. end;
  12. {$ELSE}
  13. { TProfilePlainText }
  14. constructor TProfilePlainText.Create(const aFileName: string);
  15. begin
  16. inherited;
  17. AssignFile(fDF, aFileName);
  18. SetTextBuf(fDF, {%H-}fBuffer[0], sizeof(fBuffer));
  19. Rewrite(fDF);
  20. end;
  21. destructor TProfilePlainText.Destroy;
  22. begin
  23. CloseFile(fDF);
  24. inherited;
  25. end;
  26. procedure TProfilePlainText.WriteEnter(Thread: TThreadID; When: Int64; Func, Src: String; Line: Integer);
  27. var
  28. l: string;
  29. begin
  30. l:= hexStr(When, 16)+ ';'+hexStr(Thread, 4)+ ';'+Src+ ';'+IntToStr(Line)+';'+Func;
  31. WriteLn(fDF, l);
  32. end;
  33. procedure TProfilePlainText.WriteLeave(Thread: TThreadID; When: Int64);
  34. var
  35. l: string;
  36. begin
  37. l:= hexStr(When, 16)+ ';'+hexStr(Thread, 4)+ ';';
  38. WriteLn(fDF, l);
  39. end;
  40. {$ENDIF}