-
Notifications
You must be signed in to change notification settings - Fork 379
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
Custom SQL modules #1001
Comments
Hey, Glad to hear you're making use of Perfetto - it's always fun to hear about how folks are using the tool! As you noticed we don't support including SQL modules from a URL and unfortunately I don't think we'll ever support something like this. The usual way to extend Perfetto's functionality is via stdlib modules or UI plugins. If you can fork and self host Perfetto, this will provide the most integrated solution. However, I realize it's is not always practical. If you're using the UI through ui.perfetto.dev, I can't think of a great solution for you right now. However something we have been planning on adding for a while is a startup list - a list of commands that run when you load a trace, which could include running some SQL. This would be stored in localstorage and so would need to be synchronized between machines but would solve the tedium of pasting the macro for every session. It's on my roadmap, but I'm not entirely sure I can reliability give you an estimate for when it'll be available, as there's a lot more higher priority to work I need to get to first. If you're using trace processor on the command line, you can actually run it as a server and point your browser to it. You can optionally start it with a query file with Thinking a little more ad-hoc here, we do expose certain apis on the window object, so for example you can run the following in chrome devtools to run arbitrary queries: window.app.trace.engine.query('<your sql here>'); I believe there are a number of ways to inject arbitrary javascript into webpages (bookmarklets, chrome extensions, etc), so I can imagine with a little creativity you could find a way to inject some SQL every time you load a trace, though please be aware that this api is mainly used for debugging and thus might be subject to change - we make no effort to be backward compatible. |
Is the real solution for this not out of tree UI plugins? |
Out of tree plugins could be a nice solution too, especially if @0phoff wants to add UI features like tracks and panels too. I'd argue that this is further away than the startup command list though. |
Hey, |
Hey,
I am (ab)using your Perfetto tool to visualize json trace files I created with a custom C++ profiler I built.
I love the simple flame graph interface, combined with the ability to use SQL for more complex tasks.
Currently, I used
CREATE PERFETTO MACRO
to simplify my debugging process with some querying functionality I often use, which works great. The only annoying thing is that I need to go to my computer, copy the contents of this SQL macro file and past it in each perfetto session so that I can use it. I am using perfetto on multiple machines, which does not make it any easier to always find the files where I wrote all my macros.I saw in your documentation that there exists a
INCLUDE PERFETTO MODULE
syntax to include files.Is there any way to use this syntax to include a custom file that is hosted at a certain URL ?
There might be some safety concerns to blindly include remote source files, but it would sure be nice to have a single line to remember, rather than copy-pasting entire files in the SQL query box.
Such a feature would also allow me to more easily share macros, functions, etc. with colleagues that are using my profiler.
I am sorry if such a feature has already been asked for, but I could not find any related issues.
The text was updated successfully, but these errors were encountered: