-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Track object usage #399
Track object usage #399
Conversation
I left out the idea to measure buffer and texture memory consumption. For buffers this is straightforward, but for textures we'd have to deduce the bits-per-pixel from the texture format, and then its still an estimate for compressed textures. I think we can come a long way, probably the easiest is to create a big dict that maps texture formats to bbp. Maybe for another pr? |
Updated top post to show an example of the produced diagnostics. |
Nice work! I'm curious to see how valuable this will be when investigating our memory usage patterns. |
Working on that now. And found a little annoyance that I fixed, pushed to this branch. |
Closes #356
The idea is quite simple, bump a counter when an object gets created, decrease it when it's destroyed. We have
wgpuGenerateReport
that produces a similar list, composed by wgpu-core. We can perhaps combine these. At least report both. Then when leaks occur, it'd be easier to see where this happens.I got enthusiastic about adding more diagnostic data. I added a base class that can be subclassed to produce diagnostic data in the form of a dict.
Diagnistics
subclasses can be created for e.g. system info, object counts, wgpu-native info, wgu-native object counts, etc. There's a function that can produce a textual report (table) from the produced dicts.GPU.print_report()
.Next up: use this to create extensive tests against memory leaks.
To print a full diagnostic report:
To inspect (for example) the total buffer usage:
Running
cube.py
and thenwgpu.diagnostics.print_report()
: