Closed skyne98 closed 1 year ago
Would this not spoil the code with hunderts of enter/leave codes? It looks like a more complicated way to archive the same. Only advantage is that it goes to an isolate.
For me it should be KISS:
I would vote for a dead simple function to wrap any call, it would report start and end. If performance testing is off it just calls the function. If the performance flag is const the compiler should kickoff the not needed code.
This would allow the user to call any function with thus to monitor it.
Switch from time calculation and aggregation to sampling in
prefmon
. This means moving from calculating time spent in a function or block of code and reporting it to reporting a place in code where execution currently happens whenever the external monitoring tool requires it. It should resolve the issue of too much overhead from aggregating data and allow for nearly infinite (and configurable) granularity in measurements.Source of inspiration: .NET, JS and Dart debugging tools.
Acceptance criteria:
isolate
(or any other agent running in parallel to the program) that keeps track of the current block of code in execution, based on the program itself reporting it (without some specific rate, real-time)prefmon
, having a TCP (WS) connection to it, requests or receives a current executing scope at a specified rateprefmon
should receive a specific number of samples (for example 1 000 000 over 1000 ms or 1000 per 1 ms) so that it can make an educated guess about the % of time that was spent in a specific part of codeperformanceEnter(<function or block name>)
andperformanceLeave()
functions that directly report to the isolate with as little overhead as possibleSome notes: On the isolate side, the current place of execution is probably not a single name, but a stack, which represents the current call stack. Otherwise, the
performanceLeave()
will have nothing to reset and "prefmon" will not be able to decide in which exact "child" function it is.