Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic tracing #5757

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

basic tracing #5757

wants to merge 13 commits into from

Conversation

c-cube
Copy link
Contributor

@c-cube c-cube commented Dec 8, 2023

This is WIP.

I'm adding tracing to find why opam is so slow on my machine. It gives excellent insights on where time is spent (e.g after opam upd, all 30k files are read one by one, to update the cache).

I've been instrumenting things as I explore but it needs to be more principled in general I think.

The overhead when tracing is not active (ie TRACE_FILE is not set) should be fairly low.

@kit-ty-kate
Copy link
Member

Thanks a lot for this! I have a couple of questions:

  • I’m not familiar with this tracing format. Is it used by a visualisation tool? If so which one?
  • If not, what are the advantages compared to --debug-level=3?
  • Is the dependency on mtime necessary or could we use something that already exists for --debug-level=3 for example?

@c-cube
Copy link
Contributor Author

c-cube commented Dec 8, 2023

  • the tracing format is the classic JSON file for chrome://tracing, which can also be read by https://ui.perfetto.dev/
    (see also past example of this 1). So you can easily visualize it.

    It can look like this:
    2023-12-08-153651_2042x736_scrot

  • I think we could use Unix.gettimeofday() instead, I think, we don't need that high precision in general. I got a bit over enthusiastic.

@c-cube c-cube marked this pull request as ready for review December 13, 2023 16:25
Copy link
Member

@kit-ty-kate kit-ty-kate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on first glance

@kit-ty-kate
Copy link
Member

We’re trying to get 2.2.0 out the door asap and i’d prefer to merge this after the release to avoid unnecessary time spent in extra maintenance and CI work (don’t worry the CI failure is unrelated to you changes).
Is that ok for you?

@c-cube
Copy link
Contributor Author

c-cube commented Jan 2, 2024

Of course, no worries! This is really a tool to debug/improve opam itself, not something end users urgently need, I think.

@kit-ty-kate kit-ty-kate added this to PR in Progress in Opam 2.3 via automation Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Opam 2.3
  
PR in Progress
Development

Successfully merging this pull request may close these issues.

None yet

2 participants