Profiler File Layout: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
(Created page with "The profiler output file will be a sequence of variable length records of various types. The first byte of each record will provide the record type, the length and record information will be record type specific. All numbers are network byte order. CREATE MODULE MAPPING Byte 1: 1 Byte 2-3: 16 bit module number Byte 4-5: 16 bit File Name Length Byte 6-end: File Name CURRENT LINE Current line information is started with this record and will be ended with a END CURRENT...")
 
No edit summary
Line 1: Line 1:
The profiler output file will be a sequence of variable length records of various types.  The first byte of each record will provide the record type, the length and record information will be record type specific.  All numbers are network byte order.
= Profiler Output File Format =


CREATE MODULE MAPPING
The profiler output file will be a sequence of variable-length records of various types. The first byte of each record provides the record type, while the length and record information are record-type specific. All numbers are in '''network byte order'''.
Byte 1: 1
Byte 2-3: 16 bit module number
Byte 4-5: 16 bit File Name Length
Byte 6-end: File Name


CURRENT LINE
== CREATE MODULE MAPPING ==
Current line information is started with this record and will be ended with a END CURRENT LINE
record
Byte 1: 3
Byte 2-3: module number
Byte 4-7: line number
Byte 8: clause number


TIME SPENT IN LINE
* '''Byte 1:''' 1
these records will only exist for timed sampling
* '''Byte 2–3:''' 16-bit module number
they will always occur between CURRENT LINE and END CURRENT LINE
* '''Byte 4–5:''' 16-bit File Name Length
Byte 1: 4
* '''Byte 6–end:''' File Name
Byte 2 – 9: 8 bit time spent in line in nano-seconds.


BACKTRACE INFORMATION
== CURRENT LINE ==
these records may or may not exist depending on creation options
Current line information begins with this record and ends with an '''END CURRENT LINE''' record.
they will always occur between CURRENT LINE and END CURRENT LINE
Note: besides the record type identifier, these records have the same format as CURRENT LINE
Byte 1: 5
Byte 2-3: module number
Byte 4-7: line number
Byte 8: clause number


FUNCTION NAME:
* '''Byte 1:''' 3
These records may or may not exist depending on creation options.
* '''Byte 2–3:''' module number
These records will follow immediately after either CURRENT LINE or BACKTRACE INFORMATION
* '''Byte 4–7:''' line number
Byte 1:7
* '''Byte 8:''' clause number
Byte 2: 8-bit name length
Byte 3- on: function name


GOSUB:
== TIME SPENT IN LINE ==
These records may or may not exist depending on creation options.
These records exist only for timed sampling. They always occur between '''CURRENT LINE''' and '''END CURRENT LINE'''.
These records will follow immediately after either CURRENT LINE or BACKTRACE INFORMATION
Byte 1:8


MAIN ROUTINE:
* '''Byte 1:''' 4
These records may or may not exist depending on creation options.
* '''Byte 2–9:''' 8-byte time spent in line (nanoseconds)
These records will follow immediately after either CURRENT LINE or BACKTRACE INFORMATION
This indicates that the given line is neither in a GOSUB or in a function body.
Byte 1:9


END CURRENT LINE
== BACKTRACE INFORMATION ==
Byte 1: 6
These records may or may not exist depending on creation options. They always occur between '''CURRENT LINE''' and '''END CURRENT LINE'''.


Potential syntax
Note: Apart from the record type identifier, these records have the same format as '''CURRENT LINE'''.


DEBUG PROFILE SAMPLED filename
* '''Byte 1:''' 5
DEBUG PROFILE TIMED filename
* '''Byte 2–3:''' module number
DEBUG PROFILE STOP
* '''Byte 4–7:''' line number
* '''Byte 8:''' clause number
 
== FUNCTION NAME ==
These records may or may not exist depending on creation options. They follow immediately after either '''CURRENT LINE''' or '''BACKTRACE INFORMATION'''.
 
* '''Byte 1:''' 7
* '''Byte 2:''' 8-bit name length
* '''Byte 3–on:''' function name
 
== GOSUB ==
These records may or may not exist depending on creation options. They follow immediately after either '''CURRENT LINE''' or '''BACKTRACE INFORMATION'''.
 
* '''Byte 1:''' 8
 
== MAIN ROUTINE ==
These records may or may not exist depending on creation options. They follow immediately after either '''CURRENT LINE''' or '''BACKTRACE INFORMATION'''.
 
This indicates that the given line is neither in a GOSUB nor in a function body.
 
* '''Byte 1:''' 9
 
== END CURRENT LINE ==
 
* '''Byte 1:''' 6
 
= Potential Syntax =
 
* <code>DEBUG PROFILE SAMPLED filename</code>
* <code>DEBUG PROFILE TIMED filename</code>
* <code>DEBUG PROFILE STOP</code>

Revision as of 17:10, 12 September 2025

Profiler Output File Format

The profiler output file will be a sequence of variable-length records of various types. The first byte of each record provides the record type, while the length and record information are record-type specific. All numbers are in network byte order.

CREATE MODULE MAPPING

  • Byte 1: 1
  • Byte 2–3: 16-bit module number
  • Byte 4–5: 16-bit File Name Length
  • Byte 6–end: File Name

CURRENT LINE

Current line information begins with this record and ends with an END CURRENT LINE record.

  • Byte 1: 3
  • Byte 2–3: module number
  • Byte 4–7: line number
  • Byte 8: clause number

TIME SPENT IN LINE

These records exist only for timed sampling. They always occur between CURRENT LINE and END CURRENT LINE.

  • Byte 1: 4
  • Byte 2–9: 8-byte time spent in line (nanoseconds)

BACKTRACE INFORMATION

These records may or may not exist depending on creation options. They always occur between CURRENT LINE and END CURRENT LINE.

Note: Apart from the record type identifier, these records have the same format as CURRENT LINE.

  • Byte 1: 5
  • Byte 2–3: module number
  • Byte 4–7: line number
  • Byte 8: clause number

FUNCTION NAME

These records may or may not exist depending on creation options. They follow immediately after either CURRENT LINE or BACKTRACE INFORMATION.

  • Byte 1: 7
  • Byte 2: 8-bit name length
  • Byte 3–on: function name

GOSUB

These records may or may not exist depending on creation options. They follow immediately after either CURRENT LINE or BACKTRACE INFORMATION.

  • Byte 1: 8

MAIN ROUTINE

These records may or may not exist depending on creation options. They follow immediately after either CURRENT LINE or BACKTRACE INFORMATION.

This indicates that the given line is neither in a GOSUB nor in a function body.

  • Byte 1: 9

END CURRENT LINE

  • Byte 1: 6

Potential Syntax

  • DEBUG PROFILE SAMPLED filename
  • DEBUG PROFILE TIMED filename
  • DEBUG PROFILE STOP