nimskull
nimskull copied to clipboard
structure vm profiler data output
Implement vm profiler data reporting as a structured data. Formatter proc is located in vmprofiler.dump - it outputs string, so can be almost directly moved to cli_reporter.nim. The profiler data itself is already structured in the ProfileData, so it just has to be moved to the reports definition
+ ProfileInfo* = object
+ time*: float
+ count*: int
+ ProfileData* = ref object
+ data*: TableRef[TLineInfo, ProfileInfo]
InternalReport* = object of ReportBase
## Report generated for the internal compiler workings
msg*: string
case kind*: ReportKind
+ of rintVmProfile:
+ profileData: ProfileData
In which file i can find this? i was unable to locate the code
- internal report that profile data report should be moved to is https://github.com/nim-works/nimskull/blob/36ad310334a687891c1c374f8f955c0af8ee47ff/compiler/ast/reports.nim#L1700
- profile data definition type https://github.com/nim-works/nimskull/blob/36ad310334a687891c1c374f8f955c0af8ee47ff/compiler/front/options.nim#L260
- reportBody proc that formatting logic itself should be moved to https://github.com/nim-works/nimskull/blob/36ad310334a687891c1c374f8f955c0af8ee47ff/compiler/front/cli_reporter.nim#L2713
- dump proc needs to be removed https://github.com/nim-works/nimskull/blob/36ad310334a687891c1c374f8f955c0af8ee47ff/compiler/vm/vmprofiler.nim#L42 and call to it should be replaced by
localReportwithInternalReport(kind: rintVmProfile, profileData: <get profile data from the conf field>)
This should not be added to reports, it's a legacy subsystem and no more stuff should go in there.
An entirely new approach needs to be determined, this isn't a good first issue. I'm closing it for now.