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

IPython profile magic _sometime_ records extra time on the main thread. #313

Open
Carreau opened this issue Jun 10, 2024 · 1 comment
Open

Comments

@Carreau
Copy link

Carreau commented Jun 10, 2024

Mostly this create deep hard to read report as def _trim_stem trimms nothing:

35.438 MainThread  <thread>:139648662820672
`- 35.437 <module>  ../../../../../../bin/ipython:1
   `- 35.437 start_ipython  IPython/__init__.py:104
      `- 35.437 TerminalIPythonApp.launch_instance  traitlets/config/application.py:1069
         `- 35.437 TerminalIPythonApp.start  IPython/terminal/ipapp.py:320
            `- 35.437 TerminalInteractiveShell.mainloop  IPython/terminal/interactiveshell.py:906
               `- 35.437 TerminalInteractiveShell.interact  IPython/terminal/interactiveshell.py:890
                  `- 35.437 TerminalInteractiveShell.run_cell  IPython/core/interactiveshell.py:3083
                     `- 35.437 TerminalInteractiveShell._run_cell  IPython/core/interactiveshell.py:3125
                        `- 35.437 _pseudo_sync_runner  IPython/core/async_helpers.py:120
                           `- 35.437 TerminalInteractiveShell.run_cell_async  IPython/core/interactiveshell.py:3224
                              `- 35.437 TerminalInteractiveShell.run_ast_nodes  IPython/core/interactiveshell.py:3459
                                 `- 35.437 <module>  <ipython-input-3-70d0375aba7c>:1
                                    `- 35.437 TerminalInteractiveShell.run_line_magic  IPython/core/interactiveshell.py:2443
                                       `- 35.437 PyinstrumentMagic.pyinstrument  pyinstrument/magic/magic.py:44
                                          `- 35.437 TerminalInteractiveShell.run_cell  IPython/core/interactiveshell.py:3083
...

I can't investigate why, as I do not have access to the code that does this, only reports.

The only thing I can suggest is to elide in the middle and re-root PyinstrumentMagic.pyinstrument to be a direct child of the main thread, or if there another option to hide frames globally instead of fixing every renderers ?

Alternatively if you have any idea why the Mainthread registers more time...

@joerick
Copy link
Owner

joerick commented Jun 10, 2024

my guess is that there's a frame somewhere that has been removed by a processor. Can you print the profile with show_all=True? e.g. ConsoleRenderer(show_all=True).render(session)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants