node icon indicating copy to clipboard operation
node copied to clipboard

src: collect sync api call stack

Open theanarkh opened this issue 2 years ago • 4 comments

Adds an option to support writing call stack of sync api to file. The format is as follows.

a -> b -> c
d -> e -> f
  • [x] make -j4 test (UNIX), or vcbuild test (Windows) passes
  • [x] tests and/or benchmarks are included
  • [x] documentation is changed or added
  • [x] commit message follows commit guidelines

theanarkh avatar Sep 09 '22 19:09 theanarkh

@legendecas Hi, can you help review this PR ? Thanks !

theanarkh avatar Sep 14 '22 18:09 theanarkh

I'm confused by the file format. Would you mind elaborating on the reasoning why we need a dedicated file for this instead of inspecting the conventional stack trace output to stout/stderr?

legendecas avatar Sep 16 '22 02:09 legendecas

I think if the call stack information is output to stdout / stderr.

  1. it will be mixed with other information and not easy to see because there may be a lot of other log output.
  2. it can not be collected and analyzed.

If this PR is ok, I plan to submit another PR that we can control the flag at runtime.

As for the file format, currently a synchronous API call corresponds to one line in the file, and each line is separated by -> which is easier to parse.

theanarkh avatar Sep 16 '22 03:09 theanarkh

I think if the call stack information is output to stdout / stderr.

  1. it will be mixed with other information and not easy to see because there may be a lot of other log output.
  2. it can not be collected and analyzed.

In this case, I'd find that it can be more extensible if we can emit diagnostic events in the case, e.g., through diagnostic channels. This allows userland modules to monitor the sync calls and output with arbitrary formats of stack traces.

legendecas avatar Sep 19 '22 16:09 legendecas