Skip to content

Commit 47eb348

Browse files
Deploying to master from @ gfx-rs/wgpu@59a03ea 🚀
1 parent f067248 commit 47eb348

File tree

8 files changed

+65
-64
lines changed

8 files changed

+65
-64
lines changed

doc/src/wgpu_types/counters.rs.html

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -181,58 +181,59 @@
181181
<a href=#181 id=181 data-nosnippet>181</a> <span class="doccomment">/// Sum of the memory used by all allocations, in bytes.
182182
<a href=#182 id=182 data-nosnippet>182</a> </span><span class="kw">pub </span>total_allocated_bytes: u64,
183183
<a href=#183 id=183 data-nosnippet>183</a> <span class="doccomment">/// Sum of the memory reserved by all memory blocks including unallocated regions, in bytes.
184-
<a href=#184 id=184 data-nosnippet>184</a> </span><span class="kw">pub </span>total_reserved_bytes: u64,
185-
<a href=#185 id=185 data-nosnippet>185</a>}
186-
<a href=#186 id=186 data-nosnippet>186</a>
187-
<a href=#187 id=187 data-nosnippet>187</a><span class="kw">impl </span>fmt::Debug <span class="kw">for </span>AllocationReport {
188-
<a href=#188 id=188 data-nosnippet>188</a> <span class="kw">fn </span>fmt(<span class="kw-2">&amp;</span><span class="self">self</span>, f: <span class="kw-2">&amp;mut </span>fmt::Formatter&lt;<span class="lifetime">'_</span>&gt;) -&gt; fmt::Result {
189-
<a href=#189 id=189 data-nosnippet>189</a> <span class="kw">let </span>name = <span class="kw">if </span>!<span class="self">self</span>.name.is_empty() {
190-
<a href=#190 id=190 data-nosnippet>190</a> <span class="self">self</span>.name.as_str()
191-
<a href=#191 id=191 data-nosnippet>191</a> } <span class="kw">else </span>{
192-
<a href=#192 id=192 data-nosnippet>192</a> <span class="string">"--"
193-
<a href=#193 id=193 data-nosnippet>193</a> </span>};
194-
<a href=#194 id=194 data-nosnippet>194</a> <span class="macro">write!</span>(f, <span class="string">"{name:?}: {}"</span>, FmtBytes(<span class="self">self</span>.size))
195-
<a href=#195 id=195 data-nosnippet>195</a> }
196-
<a href=#196 id=196 data-nosnippet>196</a>}
197-
<a href=#197 id=197 data-nosnippet>197</a>
198-
<a href=#198 id=198 data-nosnippet>198</a><span class="kw">impl </span>fmt::Debug <span class="kw">for </span>AllocatorReport {
199-
<a href=#199 id=199 data-nosnippet>199</a> <span class="kw">fn </span>fmt(<span class="kw-2">&amp;</span><span class="self">self</span>, f: <span class="kw-2">&amp;mut </span>fmt::Formatter&lt;<span class="lifetime">'_</span>&gt;) -&gt; fmt::Result {
200-
<a href=#200 id=200 data-nosnippet>200</a> <span class="kw">let </span><span class="kw-2">mut </span>allocations = <span class="self">self</span>.allocations.clone();
201-
<a href=#201 id=201 data-nosnippet>201</a> allocations.sort_by_key(|alloc| core::cmp::Reverse(alloc.size));
202-
<a href=#202 id=202 data-nosnippet>202</a>
203-
<a href=#203 id=203 data-nosnippet>203</a> <span class="kw">let </span>max_num_allocations_to_print = f.precision().unwrap_or(usize::MAX);
204-
<a href=#204 id=204 data-nosnippet>204</a> allocations.truncate(max_num_allocations_to_print);
205-
<a href=#205 id=205 data-nosnippet>205</a>
206-
<a href=#206 id=206 data-nosnippet>206</a> f.debug_struct(<span class="string">"AllocatorReport"</span>)
207-
<a href=#207 id=207 data-nosnippet>207</a> .field(
208-
<a href=#208 id=208 data-nosnippet>208</a> <span class="string">"summary"</span>,
209-
<a href=#209 id=209 data-nosnippet>209</a> <span class="kw-2">&amp;</span><span class="macro">core::format_args!</span>(
210-
<a href=#210 id=210 data-nosnippet>210</a> <span class="string">"{} / {}"</span>,
211-
<a href=#211 id=211 data-nosnippet>211</a> FmtBytes(<span class="self">self</span>.total_allocated_bytes),
212-
<a href=#212 id=212 data-nosnippet>212</a> FmtBytes(<span class="self">self</span>.total_reserved_bytes)
213-
<a href=#213 id=213 data-nosnippet>213</a> ),
214-
<a href=#214 id=214 data-nosnippet>214</a> )
215-
<a href=#215 id=215 data-nosnippet>215</a> .field(<span class="string">"blocks"</span>, <span class="kw-2">&amp;</span><span class="self">self</span>.blocks.len())
216-
<a href=#216 id=216 data-nosnippet>216</a> .field(<span class="string">"allocations"</span>, <span class="kw-2">&amp;</span><span class="self">self</span>.allocations.len())
217-
<a href=#217 id=217 data-nosnippet>217</a> .field(<span class="string">"largest"</span>, <span class="kw-2">&amp;</span>allocations.as_slice())
218-
<a href=#218 id=218 data-nosnippet>218</a> .finish()
219-
<a href=#219 id=219 data-nosnippet>219</a> }
220-
<a href=#220 id=220 data-nosnippet>220</a>}
221-
<a href=#221 id=221 data-nosnippet>221</a>
222-
<a href=#222 id=222 data-nosnippet>222</a><span class="kw">struct </span>FmtBytes(u64);
223-
<a href=#223 id=223 data-nosnippet>223</a>
224-
<a href=#224 id=224 data-nosnippet>224</a><span class="kw">impl </span>fmt::Display <span class="kw">for </span>FmtBytes {
225-
<a href=#225 id=225 data-nosnippet>225</a> <span class="kw">fn </span>fmt(<span class="kw-2">&amp;</span><span class="self">self</span>, f: <span class="kw-2">&amp;mut </span>fmt::Formatter&lt;<span class="lifetime">'_</span>&gt;) -&gt; fmt::Result {
226-
<a href=#226 id=226 data-nosnippet>226</a> <span class="kw">const </span>SUFFIX: [<span class="kw-2">&amp;</span>str; <span class="number">5</span>] = [<span class="string">"B"</span>, <span class="string">"KB"</span>, <span class="string">"MB"</span>, <span class="string">"GB"</span>, <span class="string">"TB"</span>];
227-
<a href=#227 id=227 data-nosnippet>227</a> <span class="kw">let </span><span class="kw-2">mut </span>idx = <span class="number">0</span>;
228-
<a href=#228 id=228 data-nosnippet>228</a> <span class="kw">let </span><span class="kw-2">mut </span>amount = <span class="self">self</span>.<span class="number">0 </span><span class="kw">as </span>f64;
229-
<a href=#229 id=229 data-nosnippet>229</a> <span class="kw">loop </span>{
230-
<a href=#230 id=230 data-nosnippet>230</a> <span class="kw">if </span>amount &lt; <span class="number">1024.0 </span>|| idx == SUFFIX.len() - <span class="number">1 </span>{
231-
<a href=#231 id=231 data-nosnippet>231</a> <span class="kw">return </span><span class="macro">write!</span>(f, <span class="string">"{:.2} {}"</span>, amount, SUFFIX[idx]);
232-
<a href=#232 id=232 data-nosnippet>232</a> }
233-
<a href=#233 id=233 data-nosnippet>233</a>
234-
<a href=#234 id=234 data-nosnippet>234</a> amount /= <span class="number">1024.0</span>;
235-
<a href=#235 id=235 data-nosnippet>235</a> idx += <span class="number">1</span>;
236-
<a href=#236 id=236 data-nosnippet>236</a> }
237-
<a href=#237 id=237 data-nosnippet>237</a> }
238-
<a href=#238 id=238 data-nosnippet>238</a>}</code></pre></div></section></main></body></html>
184+
<a href=#184 id=184 data-nosnippet>184</a> </span><span class="comment">// XXX: Rename to total_capacity_bytes following the rename at https://github.com/Traverse-Research/gpu-allocator/pull/266?
185+
<a href=#185 id=185 data-nosnippet>185</a> </span><span class="kw">pub </span>total_reserved_bytes: u64,
186+
<a href=#186 id=186 data-nosnippet>186</a>}
187+
<a href=#187 id=187 data-nosnippet>187</a>
188+
<a href=#188 id=188 data-nosnippet>188</a><span class="kw">impl </span>fmt::Debug <span class="kw">for </span>AllocationReport {
189+
<a href=#189 id=189 data-nosnippet>189</a> <span class="kw">fn </span>fmt(<span class="kw-2">&amp;</span><span class="self">self</span>, f: <span class="kw-2">&amp;mut </span>fmt::Formatter&lt;<span class="lifetime">'_</span>&gt;) -&gt; fmt::Result {
190+
<a href=#190 id=190 data-nosnippet>190</a> <span class="kw">let </span>name = <span class="kw">if </span>!<span class="self">self</span>.name.is_empty() {
191+
<a href=#191 id=191 data-nosnippet>191</a> <span class="self">self</span>.name.as_str()
192+
<a href=#192 id=192 data-nosnippet>192</a> } <span class="kw">else </span>{
193+
<a href=#193 id=193 data-nosnippet>193</a> <span class="string">"--"
194+
<a href=#194 id=194 data-nosnippet>194</a> </span>};
195+
<a href=#195 id=195 data-nosnippet>195</a> <span class="macro">write!</span>(f, <span class="string">"{name:?}: {}"</span>, FmtBytes(<span class="self">self</span>.size))
196+
<a href=#196 id=196 data-nosnippet>196</a> }
197+
<a href=#197 id=197 data-nosnippet>197</a>}
198+
<a href=#198 id=198 data-nosnippet>198</a>
199+
<a href=#199 id=199 data-nosnippet>199</a><span class="kw">impl </span>fmt::Debug <span class="kw">for </span>AllocatorReport {
200+
<a href=#200 id=200 data-nosnippet>200</a> <span class="kw">fn </span>fmt(<span class="kw-2">&amp;</span><span class="self">self</span>, f: <span class="kw-2">&amp;mut </span>fmt::Formatter&lt;<span class="lifetime">'_</span>&gt;) -&gt; fmt::Result {
201+
<a href=#201 id=201 data-nosnippet>201</a> <span class="kw">let </span><span class="kw-2">mut </span>allocations = <span class="self">self</span>.allocations.clone();
202+
<a href=#202 id=202 data-nosnippet>202</a> allocations.sort_by_key(|alloc| core::cmp::Reverse(alloc.size));
203+
<a href=#203 id=203 data-nosnippet>203</a>
204+
<a href=#204 id=204 data-nosnippet>204</a> <span class="kw">let </span>max_num_allocations_to_print = f.precision().unwrap_or(usize::MAX);
205+
<a href=#205 id=205 data-nosnippet>205</a> allocations.truncate(max_num_allocations_to_print);
206+
<a href=#206 id=206 data-nosnippet>206</a>
207+
<a href=#207 id=207 data-nosnippet>207</a> f.debug_struct(<span class="string">"AllocatorReport"</span>)
208+
<a href=#208 id=208 data-nosnippet>208</a> .field(
209+
<a href=#209 id=209 data-nosnippet>209</a> <span class="string">"summary"</span>,
210+
<a href=#210 id=210 data-nosnippet>210</a> <span class="kw-2">&amp;</span><span class="macro">core::format_args!</span>(
211+
<a href=#211 id=211 data-nosnippet>211</a> <span class="string">"{} / {}"</span>,
212+
<a href=#212 id=212 data-nosnippet>212</a> FmtBytes(<span class="self">self</span>.total_allocated_bytes),
213+
<a href=#213 id=213 data-nosnippet>213</a> FmtBytes(<span class="self">self</span>.total_reserved_bytes)
214+
<a href=#214 id=214 data-nosnippet>214</a> ),
215+
<a href=#215 id=215 data-nosnippet>215</a> )
216+
<a href=#216 id=216 data-nosnippet>216</a> .field(<span class="string">"blocks"</span>, <span class="kw-2">&amp;</span><span class="self">self</span>.blocks.len())
217+
<a href=#217 id=217 data-nosnippet>217</a> .field(<span class="string">"allocations"</span>, <span class="kw-2">&amp;</span><span class="self">self</span>.allocations.len())
218+
<a href=#218 id=218 data-nosnippet>218</a> .field(<span class="string">"largest"</span>, <span class="kw-2">&amp;</span>allocations.as_slice())
219+
<a href=#219 id=219 data-nosnippet>219</a> .finish()
220+
<a href=#220 id=220 data-nosnippet>220</a> }
221+
<a href=#221 id=221 data-nosnippet>221</a>}
222+
<a href=#222 id=222 data-nosnippet>222</a>
223+
<a href=#223 id=223 data-nosnippet>223</a><span class="kw">struct </span>FmtBytes(u64);
224+
<a href=#224 id=224 data-nosnippet>224</a>
225+
<a href=#225 id=225 data-nosnippet>225</a><span class="kw">impl </span>fmt::Display <span class="kw">for </span>FmtBytes {
226+
<a href=#226 id=226 data-nosnippet>226</a> <span class="kw">fn </span>fmt(<span class="kw-2">&amp;</span><span class="self">self</span>, f: <span class="kw-2">&amp;mut </span>fmt::Formatter&lt;<span class="lifetime">'_</span>&gt;) -&gt; fmt::Result {
227+
<a href=#227 id=227 data-nosnippet>227</a> <span class="kw">const </span>SUFFIX: [<span class="kw-2">&amp;</span>str; <span class="number">5</span>] = [<span class="string">"B"</span>, <span class="string">"KB"</span>, <span class="string">"MB"</span>, <span class="string">"GB"</span>, <span class="string">"TB"</span>];
228+
<a href=#228 id=228 data-nosnippet>228</a> <span class="kw">let </span><span class="kw-2">mut </span>idx = <span class="number">0</span>;
229+
<a href=#229 id=229 data-nosnippet>229</a> <span class="kw">let </span><span class="kw-2">mut </span>amount = <span class="self">self</span>.<span class="number">0 </span><span class="kw">as </span>f64;
230+
<a href=#230 id=230 data-nosnippet>230</a> <span class="kw">loop </span>{
231+
<a href=#231 id=231 data-nosnippet>231</a> <span class="kw">if </span>amount &lt; <span class="number">1024.0 </span>|| idx == SUFFIX.len() - <span class="number">1 </span>{
232+
<a href=#232 id=232 data-nosnippet>232</a> <span class="kw">return </span><span class="macro">write!</span>(f, <span class="string">"{:.2} {}"</span>, amount, SUFFIX[idx]);
233+
<a href=#233 id=233 data-nosnippet>233</a> }
234+
<a href=#234 id=234 data-nosnippet>234</a>
235+
<a href=#235 id=235 data-nosnippet>235</a> amount /= <span class="number">1024.0</span>;
236+
<a href=#236 id=236 data-nosnippet>236</a> idx += <span class="number">1</span>;
237+
<a href=#237 id=237 data-nosnippet>237</a> }
238+
<a href=#238 id=238 data-nosnippet>238</a> }
239+
<a href=#239 id=239 data-nosnippet>239</a>}</code></pre></div></section></main></body></html>

0 commit comments

Comments
 (0)