profiler icon indicating copy to clipboard operation
profiler copied to clipboard

Add initially selected/visible threads and ordering setting

Open parttimenerd opened this issue 1 year ago • 3 comments

The default selection of initially visible and selected threads is highly specific to the web use case, but rarely usable for imported profiles. The same is for the ordering, as the writer of the imported profile should have control over this too. This PR therefore introduces three new settings in the meta section of the profile format:

  // Indexes of the threads that are initially visible in the UI.
  // This is useful for imported profiles for which the internal visibility score
  // ranking does not make sense.
  initialVisibleThreads?: ThreadIndex[],
  // Indexes of the threads that are initially selected in the UI.
  // This is also most useful for imported profiles where just using the first thread
  // of each process might not make sense.
  initialSelectedThreads?: ThreadIndex[],
  // Keep the defined thread order
  disableThreadOrdering?: boolean,

This simple PR also includes tests (most of the lines of code) to check for the default and the new behavior.

Deployment preview production

parttimenerd avatar Oct 05 '22 10:10 parttimenerd

Codecov Report

Base: 88.44% // Head: 88.45% // Increases project coverage by +0.00% :tada:

Coverage data is based on head (1f942b1) compared to base (7b3a30c). Patch coverage: 100.00% of modified lines in pull request are covered.

:exclamation: Current head 1f942b1 differs from pull request most recent head 84459ef. Consider uploading reports for the commit 84459ef to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4263   +/-   ##
=======================================
  Coverage   88.44%   88.45%           
=======================================
  Files         282      282           
  Lines       24857    24870   +13     
  Branches     6660     6666    +6     
=======================================
+ Hits        21985    21998   +13     
  Misses       2667     2667           
  Partials      205      205           
Impacted Files Coverage Δ
src/profile-logic/tracks.js 83.85% <100.00%> (+0.39%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Oct 05 '22 11:10 codecov[bot]

Have you tried specifying these directly in the URL?

julienw avatar Oct 11 '22 14:10 julienw

No, I thought that a converter should not rely on the URL to preselect threads.

parttimenerd avatar Oct 11 '22 14:10 parttimenerd

Any thoughts @julienw ?

parttimenerd avatar Oct 19 '22 13:10 parttimenerd

I resolved the small issues you mentioned. The whole idea of this PR is to allow the profile writer to specify that the order of thread tracks is the order of the threads in the profile file. This does not need a special field that specifies the order and is therefore the simplest solution for this problem (and the most obvious for the profile writer, as the current ordering is not really expected).

parttimenerd avatar Oct 26 '22 08:10 parttimenerd

I think the more complex option is better left for future discussions, especially as we would need to decide on which the current semantics really is. Is it really just startTime?

parttimenerd avatar Oct 28 '22 13:10 parttimenerd

I renamed the flag, so it should be ready?

parttimenerd avatar Oct 28 '22 13:10 parttimenerd

I think the more complex option is better left for future discussions, especially as we would need to decide on which the current semantics really is. Is it really just startTime?

yeah I think startTime is the previous behavior and what some folks want. But I'm fine with keeping this to a future discussion.

julienw avatar Oct 28 '22 14:10 julienw