 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jeremy Darling Guest
|
Posted: Wed Nov 23, 2005 3:56 pm Post subject: To Eric |
|
|
Would you mind posting up the actual format of the files exported by
Sampling Profiler 1.3.5? I have figured out some of it, but not all of it
yet (just found some stuff I didn't know about . In any case thanks for
the great tool.
- Jeremy
|
|
| Back to top |
|
 |
Eric Grange Guest
|
Posted: Wed Nov 23, 2005 5:14 pm Post subject: Re: To Eric |
|
|
| Quote: | Would you mind posting up the actual format of the files exported by
Sampling Profiler 1.3.5? I have figured out some of it, but not all of it
yet (just found some stuff I didn't know about .
|
You mean the .spr?
It's a TWriter-compatible binary output stream which is compressed and
CRC'ed using LZRW1A in 32kb chunks. Still with me? :)
In essence, I've no idea what bytes in the file exactly mean -only the
code knows that- but I can post the main profiler streaming sequences.
LZRW1A used has been severely tweaked over the years but should be
compatible with the original lzrw1kh.pas that can be found on the web
(never tested though) if you want to give it a go.
Eric
|
|
| Back to top |
|
 |
Jeremy Darling Guest
|
Posted: Wed Nov 23, 2005 7:17 pm Post subject: Re: To Eric |
|
|
I'd love it if you could post. The compression explains the problems I'm
having . I found some things that made sense, and then poof the sense
went away . In the end I just need a way to load the data so I can
treverse it and generate my graphs .
I'll see if I can find a download of lzrw1kh.pas some place.
- Jeremy
"Eric Grange" <egrangeNO (AT) SPAMglscene (DOT) org> wrote
| Quote: | Would you mind posting up the actual format of the files exported by
Sampling Profiler 1.3.5? I have figured out some of it, but not all of
it yet (just found some stuff I didn't know about .
You mean the .spr?
It's a TWriter-compatible binary output stream which is compressed and
CRC'ed using LZRW1A in 32kb chunks. Still with me? :)
In essence, I've no idea what bytes in the file exactly mean -only the
code knows that- but I can post the main profiler streaming sequences.
LZRW1A used has been severely tweaked over the years but should be
compatible with the original lzrw1kh.pas that can be found on the web
(never tested though) if you want to give it a go.
Eric
|
|
|
| Back to top |
|
 |
Jeremy Darling Guest
|
Posted: Thu Nov 24, 2005 3:10 pm Post subject: Re: To Eric |
|
|
Eric,
I tried downloading "lzrw1kh.pas" from SWAG, since it used buffered
read/write methods I also downloaded the Delphi 32 bit wrapper for it. But
when trying to decode I get back an error of "Invalid Header". This makes
sense to me, as I'm sure you just don't write the header to save space .
My question is before I go hacking through code again are these the correct
versions? Since the 2nd uses the 1st just wraps it up nicely for Streams
this would actually be aimed completely at the proper version of lzrw1kh.
Thanks,
Jeremy
"Eric Grange" <egrangeNO (AT) SPAMglscene (DOT) org> wrote
| Quote: | Would you mind posting up the actual format of the files exported by
Sampling Profiler 1.3.5? I have figured out some of it, but not all of
it yet (just found some stuff I didn't know about .
You mean the .spr?
It's a TWriter-compatible binary output stream which is compressed and
CRC'ed using LZRW1A in 32kb chunks. Still with me? :)
In essence, I've no idea what bytes in the file exactly mean -only the
code knows that- but I can post the main profiler streaming sequences.
LZRW1A used has been severely tweaked over the years but should be
compatible with the original lzrw1kh.pas that can be found on the web
(never tested though) if you want to give it a go.
Eric
|
|
|
| Back to top |
|
 |
Eric Grange Guest
|
Posted: Thu Nov 24, 2005 4:04 pm Post subject: Re: To Eric |
|
|
| Quote: | This makes sense to me, as I'm sure you just don't write the header to save space .
|
Header has to be skipped (up to the '-').
| Quote: | My question is before I go hacking through code again are these the correct
versions? Since the 2nd uses the 1st just wraps it up nicely for Streams
this would actually be aimed completely at the proper version of lzrw1kh.
|
No idea what that 32 bits wrapper does, we're using the lzrw1kh rather
directly in the streamer. Other than that, compressed stream is like:
- total uncompressed data size (4 bytes integer)
- compressed block size (2 bytes)
- compressed block data
- uncompressed block checksum (4 bytes cardinal)
- rinse & repeat 'till no blocks left
Main data object:
procedure TProfilingData.ReadFromFiler(reader : TReader);
var
archiveVersion : integer;
locationInfo : PAddrLocationInfo;
begin
inherited ReadFromFiler(reader);
archiveVersion:=reader.ReadInteger;
if archiveVersion=0 then with reader do begin
ClearProfilingInfo;
FRawSamples.ReadFromFiler(reader);
FCallerRawSamples.ReadFromFiler(reader);
FProfilingInfo.ReadFromFiler(reader);
FTotalProfilingSamples:=ReadInteger;
ReadListBegin;
while not EndOfList do begin
New(locationInfo);
FCallersLocationInfo.AddObject(ReadString, TObject(locationInfo));
ReadAddrLocationInfo(reader, locationInfo^);
end;
ReadListEnd;
end else RaiseFilerException(archiveVersion);
end;
FRawSamples & FCallerRawSamples are integer list, using
procedure TIntegerList.ReadFromFiler(reader : TReader);
begin
SetCapacity(reader.ReadInteger);
FCount:=FCapacity;
reader.Read(FList^, FCount*SizeOf(integer));
end;
FCallersLocationInfo is a TStringList - well, sort of
FProfilingInfo is an objectlist, IIRC the streaming format is the same
as TPersistentObjectList in GLScene's PersistentClasses.pas, it stores
TProfilingInfo objects:
procedure TProfilingInfo.ReadFromFiler(reader : TReader);
var
archiveVersion : integer;
begin
inherited ReadFromFiler(reader);
archiveVersion:=reader.ReadInteger;
if archiveVersion=0 then with reader do begin
HitCount:=ReadInteger;
ReadAddrLocationInfo(reader, Location);
ReadSamplingStats(reader, Callers);
end else RaiseFilerException(archiveVersion);
end;
procedure ReadAddrLocationInfo(reader : TReader; var locInfo :
TAddrLocationInfo);
begin
with reader, locInfo do begin
ModuleName:=ReadString;
UnitName:=ReadString;
ProcName:=ReadString;
SourceName:=ReadString;
LineNumber:=ReadInteger;
end;
end;
procedure ReadSamplingStats(reader : TReader; var stats : TSamplingStats);
var
n : Integer;
begin
n:=reader.ReadInteger;
SetLength(stats, n);
if n>0 then
reader.Read(stats[0], SizeOf(TSamplingStat)*n);
end;
TSamplingStat = record
Value, Count : Integer;
end;
The inherited ReadFromFiler should all be doing nothing here (leftovers
from automated codegen). There are only versions 0 streams, but you
should still keep the version check as it's probable the structure of
some objects will change someday (at least to uniquely index the
ReadAddrLocationInfo strings, they are uniquely indexed during sampling,
but that got lost to lazyness when I added .spr export).
Eric
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|