-
Notifications
You must be signed in to change notification settings - Fork 11
Allow profiling queries #91
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
Conversation
pana is failing due to the pending |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I think this will be a great tool for debugging.
I've experimented a bit with this, and some comments so far:
Web
getAll
/execute
appear like very generic terms in the timeline.- I couldn't find the
arguments
passed in on the events displayed anywhere.
Could we instead using something like SQL: $sql
as the event name? That would make it easy to see what is happening on the timeline:
_ExclusiveContext.execute
/executeBatch
is currently missing on the timeline.
Native
I've found it quite difficult to find my way around the Dart/Flutter debugger. Eventually settled on this workflow:
- Open the debugger, Performance tab, Timeline Events.
- Click "Clear All".
- Perform the actions to time in the app.
- Click "Refresh Timeline Events".
Now you can find the timeline events. If the events are all short, you may still struggle.
Here it seems like we have two options for how the events are displayed:
TimelineTask
, like you're using currently. There, the name is used for both the track and the task name. That means it's we can't use the query in the task name - that can end up with events on hundreds of separate tracks.- Use
Timeline.startSync
instead, with the sql queries in the task name. Then the events all end up onDartWorker
tracks, with the individual names. But with our connection pooling, these will end up on arbitrary worker tracks, so still difficult to find.
This is also mentioned here: dart-lang/sdk#56274
I think given those two options, the TimelineTask
like you currently have is probably best. I think we can just consider more explicit names for the tasks, with a common prefix, e.g. sqlite:getAll
, sqlite:execute
, etc. The common prefix will let all the tracks appear next to each other.
Another alternative to consider is just logging queries to the console, perhaps in addition to the timeline. Not sure if we should make the two configurable individually.
General comments
We can consider making the timeline events enabled by default in debug builds - I think that's also the case for the built-in Flutter timeline events, and should not add more overhead than those.
There're attached to the individual events making up the slice (under event log -> search for
I've added the
Thanks, fixed 👍
A problem is also that
I agree, but we should probably also enable this by default for profile builds. |
Ah, I wasn't aware of that search in the event log. I could swear I sometimes saw the events flashing while it was loading, before being replaced by a function call tree. But searching brings those up again. Either way, it's good to know that is available for getting the args passed in now, but can be avoided in most cases where the query itself is sufficient. |
Browsers don't surface this information either way
I've removed changes to prepare a release for this branch - I want took into an issue cancelling stream subscriptions too before preparing the release. |
This adds the optional
profileQueries
option toSqliteOptions
. When enabling it, all queries and arguments will be logged to the timeline withdart:developer
APIs (that delegate toglobalSelf.performance
on web platforms).TimelineTask
APIs to measure query times outside of workers. On the web, this creates two events (xxx-begin
andxxx-end
and then callsperformance.measure
to create a mark betwen them).