nimskull icon indicating copy to clipboard operation
nimskull copied to clipboard

structure vm profiler data output

Open haxscramper opened this issue 3 years ago • 2 comments

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

haxscramper avatar Jan 24 '22 13:01 haxscramper

In which file i can find this? i was unable to locate the code

RishiKumarRay avatar Jan 24 '22 18:01 RishiKumarRay

  • 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 localReport with InternalReport(kind: rintVmProfile, profileData: <get profile data from the conf field>)

haxscramper avatar Jan 24 '22 21:01 haxscramper

This should not be added to reports, it's a legacy subsystem and no more stuff should go in there.

saem avatar Feb 13 '23 11:02 saem

An entirely new approach needs to be determined, this isn't a good first issue. I'm closing it for now.

saem avatar Feb 13 '23 11:02 saem