Skip to content

Commit d8359cd

Browse files
Documentation: Written "Statistics" chapter.
1 parent 727e8b2 commit d8359cd

File tree

7 files changed

+174
-114
lines changed

7 files changed

+174
-114
lines changed

docs/html/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ <h1><a class="anchor" id="main_table_of_contents"></a>
9696
</li>
9797
<li><a class="el" href="defragmentation.html">Defragmentation</a></li>
9898
<li><a class="el" href="lost_allocations.html">Lost allocations</a></li>
99+
<li><a class="el" href="statistics.html">Statistics</a><ul>
100+
<li><a class="el" href="statistics.html#statistics_numeric_statistics">Numeric statistics</a></li>
101+
<li><a class="el" href="statistics.html#statistics_json_dump">JSON dump</a></li>
102+
</ul>
103+
</li>
99104
<li><a class="el" href="allocation_annotation.html">Allocation names and user data</a><ul>
100105
<li><a class="el" href="allocation_annotation.html#allocation_user_data">Allocation user data</a></li>
101106
<li><a class="el" href="allocation_annotation.html#allocation_names">Allocation names</a></li>

docs/html/pages.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
<div class="contents">
6565
<div class="textblock">Here is a list of all related documentation pages:</div><div class="directory">
6666
<table class="directory">
67-
<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><a class="el" href="statistics.html" target="_self">Statistics</a></td><td class="desc"></td></tr>
6867
</table>
6968
</div><!-- directory -->
7069
</div><!-- contents -->

docs/html/search/all_c.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var searchData=
22
[
33
['size',['size',['../struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c',1,'VmaPoolStats::size()'],['../struct_vma_allocation_info.html#aac76d113a6a5ccbb09fea00fb25fd18f',1,'VmaAllocationInfo::size()']]],
4-
['statistics',['Statistics',['../statistics.html',1,'']]]
4+
['statistics',['Statistics',['../statistics.html',1,'index']]]
55
];

docs/html/search/pages_7.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var searchData=
22
[
3-
['statistics',['Statistics',['../statistics.html',1,'']]]
3+
['statistics',['Statistics',['../statistics.html',1,'index']]]
44
];

docs/html/statistics.html

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,28 @@
5656
</iframe>
5757
</div>
5858

59+
<div id="nav-path" class="navpath">
60+
<ul>
61+
<li class="navelem"><a class="el" href="index.html">Vulkan Memory Allocator</a></li> </ul>
62+
</div>
5963
</div><!-- top -->
6064
<div class="header">
6165
<div class="headertitle">
6266
<div class="title">Statistics </div> </div>
6367
</div><!--header-->
6468
<div class="contents">
65-
<div class="textblock"></div></div><!-- contents -->
69+
<div class="textblock"><p>This library contains functions that return information about its internal state, especially the amount of memory allocated from Vulkan. Please keep in mind that these functions need to traverse all internal data structures to gather these information, so they may be quite time-consuming. Don't call them too often.</p>
70+
<h1><a class="anchor" id="statistics_numeric_statistics"></a>
71+
Numeric statistics</h1>
72+
<p>You can query for overall statistics of the allocator using function <a class="el" href="vk__mem__alloc_8h.html#a333b61c1788cb23559177531e6a93ca3" title="Retrieves statistics from current state of the Allocator. ">vmaCalculateStats()</a>. Information are returned using structure <a class="el" href="struct_vma_stats.html" title="General statistics from current state of Allocator. ">VmaStats</a>. It contains <a class="el" href="struct_vma_stat_info.html" title="Calculated statistics of memory usage in entire allocator. ">VmaStatInfo</a> - number of allocated blocks, number of allocations (occupied ranges in these blocks), number of unused (free) ranges in these blocks, number of bytes used and unused (but still allocated from Vulkan) and other information. They are summed across memory heaps, memory types and total for whole allocator.</p>
73+
<p>You can query for statistics of a custom pool using function <a class="el" href="vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153" title="Retrieves statistics of existing VmaPool object. ">vmaGetPoolStats()</a>. Information are returned using structure <a class="el" href="struct_vma_pool_stats.html" title="Describes parameter of existing VmaPool. ">VmaPoolStats</a>.</p>
74+
<p>You can query for information about specific allocation using function <a class="el" href="vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b" title="Returns current information about specified allocation and atomically marks it as used in current fra...">vmaGetAllocationInfo()</a>. It fill structure <a class="el" href="struct_vma_allocation_info.html" title="Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo(). ">VmaAllocationInfo</a>.</p>
75+
<h1><a class="anchor" id="statistics_json_dump"></a>
76+
JSON dump</h1>
77+
<p>You can dump internal state of the allocator to a string in JSON format using function <a class="el" href="vk__mem__alloc_8h.html#aa4fee7eb5253377599ef4fd38c93c2a0" title="Builds and returns statistics as string in JSON format. ">vmaBuildStatsString()</a>. The result is guaranteed to be correct JSON. It uses ANSI encoding. Any strings provided by user (see <a class="el" href="allocation_annotation.html#allocation_names">Allocation names</a>) are copied as-is and properly escaped for JSON, so if they use UTF-8, ISO-8859-2 or any other encoding, this JSON string can be treted as using this encoding. It must be freed using function <a class="el" href="vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288">vmaFreeStatsString()</a>.</p>
78+
<p>The format of this string is not part of official documentation of the library, but it will not change in backward-incompatible way without increasing library major version number and mention in changelog.</p>
79+
<p>The string contains all the data that can be obtained using <a class="el" href="vk__mem__alloc_8h.html#a333b61c1788cb23559177531e6a93ca3" title="Retrieves statistics from current state of the Allocator. ">vmaCalculateStats()</a>. It can also contain detailed map of allocated memory blocks and their regions - free and occupied by allocations. This allows e.g. to visualize the memory or assess fragmentation. </p>
80+
</div></div><!-- contents -->
6681
<!-- start footer part -->
6782
<hr class="footer"/><address class="footer"><small>
6883
Generated by &#160;<a href="http://www.doxygen.org/index.html">

docs/html/vk__mem__alloc_8h_source.html

Lines changed: 109 additions & 109 deletions
Large diffs are not rendered by default.

src/vk_mem_alloc.h

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ Documentation of all members: vk_mem_alloc.h
5757
- [Choosing memory type index](@ref custom_memory_pools_MemTypeIndex)
5858
- \subpage defragmentation
5959
- \subpage lost_allocations
60+
- \subpage statistics
61+
- [Numeric statistics](@ref statistics_numeric_statistics)
62+
- [JSON dump](@ref statistics_json_dump)
6063
- \subpage allocation_annotation
6164
- [Allocation user data](@ref allocation_user_data)
6265
- [Allocation names](@ref allocation_names)
@@ -673,7 +676,45 @@ allocations (like in the example above) and don't use them.
673676
674677
\page statistics Statistics
675678
676-
679+
This library contains functions that return information about its internal state,
680+
especially the amount of memory allocated from Vulkan.
681+
Please keep in mind that these functions need to traverse all internal data structures
682+
to gather these information, so they may be quite time-consuming.
683+
Don't call them too often.
684+
685+
\section statistics_numeric_statistics Numeric statistics
686+
687+
You can query for overall statistics of the allocator using function vmaCalculateStats().
688+
Information are returned using structure #VmaStats.
689+
It contains #VmaStatInfo - number of allocated blocks, number of allocations
690+
(occupied ranges in these blocks), number of unused (free) ranges in these blocks,
691+
number of bytes used and unused (but still allocated from Vulkan) and other information.
692+
They are summed across memory heaps, memory types and total for whole allocator.
693+
694+
You can query for statistics of a custom pool using function vmaGetPoolStats().
695+
Information are returned using structure #VmaPoolStats.
696+
697+
You can query for information about specific allocation using function vmaGetAllocationInfo().
698+
It fill structure #VmaAllocationInfo.
699+
700+
\section statistics_json_dump JSON dump
701+
702+
You can dump internal state of the allocator to a string in JSON format using function vmaBuildStatsString().
703+
The result is guaranteed to be correct JSON.
704+
It uses ANSI encoding.
705+
Any strings provided by user (see [Allocation names](@ref allocation_names))
706+
are copied as-is and properly escaped for JSON, so if they use UTF-8, ISO-8859-2 or any other encoding,
707+
this JSON string can be treted as using this encoding.
708+
It must be freed using function vmaFreeStatsString().
709+
710+
The format of this string is not part of official documentation of the library,
711+
but it will not change in backward-incompatible way without increasing library major version number
712+
and mention in changelog.
713+
714+
The string contains all the data that can be obtained using vmaCalculateStats().
715+
It can also contain detailed map of allocated memory blocks and their regions -
716+
free and occupied by allocations.
717+
This allows e.g. to visualize the memory or assess fragmentation.
677718
678719
679720
\page allocation_annotation Allocation names and user data

0 commit comments

Comments
 (0)