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

[core] Improve resource and api logging. #5804

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

jimblandy
Copy link
Member

Marked as draft, because this depends on #5802.

  • Improve logging in StatelessTracker::remove_abandoned to show the
    outcome of the call.

  • Add similar logging to BufferTracker and TextureTracker.

  • Let device_create_buffer's log only the new buffer's label, id,
    and whether it's mapped at creation. It used to show the whole
    descriptor, which is too much detail.

  • Have queue_submit log the submission id, and have device_poll
    log what it was waiting for, and what actually got done.

  • Have Device::drop log the destruction of the raw device when it
    actually happens, so it's properly ordered with respect to logging
    from other parts of the device, like Device::command_allocator.

@JMS55
Copy link
Collaborator

JMS55 commented Jun 13, 2024

While you're here, maybe you feel like adding a cargo feature flag to remove logs statically? Iirc they have a fair amount of overhead just for checking if logging is enabled or not.

@jimblandy jimblandy force-pushed the core-improve-resource-api-logging branch from 9324267 to 90ef5be Compare June 13, 2024 23:53
@jimblandy
Copy link
Member Author

While you're here, maybe you feel like adding a cargo feature flag to remove logs statically? Iirc they have a fair amount of overhead just for checking if logging is enabled or not.

Sorry, I can't - this was just a drive-by.

@jimblandy jimblandy marked this pull request as ready for review June 13, 2024 23:55
@jimblandy jimblandy requested a review from a team as a code owner June 13, 2024 23:55
@Wumpf
Copy link
Member

Wumpf commented Jun 14, 2024

tbh I doubt that the checks on the log flags are significant at all given all the other things that happen in those methods, but if this actually turns out to be a measurable overhead the macros/feature flags here can be expanded accordingly
https://github.com/jimblandy/wgpu/blob/c7a16b36b16be7484c2306d1155705f3f6241bf4/wgpu-core/src/lib.rs#L309
(not in this pr obviously ;-))

wgpu-core/src/device/global.rs Outdated Show resolved Hide resolved
@nical
Copy link
Contributor

nical commented Jun 19, 2024

While you're here, maybe you feel like adding a cargo feature flag to remove logs statically? Iirc they have a fair amount of overhead just for checking if logging is enabled or not.

api_logs are trace-level (the most verbose level) by default. Apps that depend on wgpu can filter out the logs at compile time by setting the appropriate feature flags on the log crate.

- Improve logging in `StatelessTracker::remove_abandoned` to show the
  outcome of the call.

- Add similar logging to `BufferTracker` and `TextureTracker`.

- Let `device_create_buffer`'s log only the new buffer's label, id,
  and whether it's mapped at creation. It used to show the whole
  descriptor, which is too much detail.

- Have `queue_submit` log the submission id, and have `device_poll`
  log what it was waiting for, and what actually got done.

- Have `Device::drop` log the destruction of the raw device when it
  actually happens, so it's properly ordered with respect to logging
  from other parts of the device, like `Device::command_allocator`.
@jimblandy jimblandy force-pushed the core-improve-resource-api-logging branch from 90ef5be to 4aa4b3b Compare June 20, 2024 04:00
@jimblandy jimblandy enabled auto-merge (rebase) June 20, 2024 04:00
@jimblandy jimblandy merged commit 584f9e1 into gfx-rs:trunk Jun 20, 2024
25 checks passed
@jimblandy jimblandy deleted the core-improve-resource-api-logging branch June 20, 2024 04:15
@nical nical mentioned this pull request Jul 22, 2024
4 tasks
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

Successfully merging this pull request may close these issues.

4 participants