profile_doc.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /////////////////////////////////////////////////////////////////////////EA-V1
  19. // $File: //depot/GeneralsMD/Staging/code/Libraries/Source/profile/profile_doc.h $
  20. // $Author: mhoffe $
  21. // $Revision: #3 $
  22. // $DateTime: 2003/07/09 10:57:23 $
  23. //
  24. // ©2003 Electronic Arts
  25. //
  26. // additional Doxygen module documentation
  27. //////////////////////////////////////////////////////////////////////////////
  28. #ifdef _MSC_VER
  29. # pragma once
  30. #endif
  31. #ifndef PROFILE_DOC_H // Include guard
  32. #define PROFILE_DOC_H
  33. // This generates a small main page for Doxygen if a module only
  34. // documentation is built.
  35. #ifndef DOXYGEN_GLOBAL_DOC
  36. /**
  37. \mainpage %Profile module
  38. The following pages contain the most useful information:
  39. - \ref module_profile
  40. - \ref profile_cmd
  41. \internal This is the internal module documentation meant only for
  42. programmers who are working on the module internals.
  43. */
  44. #endif
  45. /**
  46. \page module_profile Profile module overview
  47. \section overview Overview
  48. The profile module contains the following logical groups:
  49. - high level hierarchical timer and logical profiling (frame based and global)
  50. - function level hierarchical timer based profiling (frame based and global)
  51. Profiling data can be accessed in different ways:
  52. - using debug commands to query for profiling data
  53. - using debug commands to set up a write-to-file mode for profile data
  54. - using the C++ interface herein
  55. \section highlevel High Level Profiling
  56. High level profiling can be done both timer based and logical. An example
  57. for a logical profile would be the number of texture changes per frame
  58. or the number of triangles rendered.
  59. The hierarchy is enforced by using a hierarchical naming scheme. For
  60. timer based profiles this hierachy is build automatically, for
  61. logical profiles each profile must be named accordingly when being created.
  62. High level profiling is available in all build configurations. All
  63. high level profile functions are optimized for speed (at least while
  64. profiling is disabled) so that there is an almost zero cost for
  65. having profiling in all configurations.
  66. \section funclevel Function Level Profiling
  67. Function level profiling determines general call statistics, e.g. call
  68. count per frame/total, time spent in function, time per call, time
  69. spend in function and children, etc.
  70. Function level profiling is available in the 'profile' build configuration
  71. only since it relies on the fact that the compiler generates '_penter'
  72. function calls at the beginning of each function.
  73. \section frames Profile frames
  74. Instead of just providing frame based profiles this module has the concept
  75. of profile ranges. A range is a period of time specified by a Begin and
  76. and End function call. All data within this range is recorded as a range.
  77. It is possible to capture to more than one active range at the same time.
  78. Ordinary frame capturing can be achieved by recording a range back-to-back.
  79. Using ranges makes it very easy to profile logically connected events, e.g.
  80. profiling a level load time.
  81. \section cmdif Command interface
  82. This module provides a Debug Module command interface called 'profile'.
  83. The commands in this command interface are basically:
  84. - enabling/disabling profiles, either for frame counts or ranges
  85. - querying of current profile data
  86. - enabling write-to-file mode for profile data
  87. */
  88. /**
  89. \page profile_cmd Profile commands
  90. Notation used:
  91. - [ abc ] means that 'abc' may or may not be specified
  92. - { abc } means that 'abc' may be specified any number of times (or not at all)
  93. - (a|b|c) means that either 'a', 'b' or 'c' must be specified once
  94. The following commands exist (group: profile):
  95. <table><tr>
  96. <td><b>Command</b></td>
  97. <td><b>Parameters</b></td>
  98. <td><b>Description</b></td>
  99. </tr><tr>
  100. <!---------------------------------->
  101. <td valign=top>result</td>
  102. <td valign=top>[ \<res_func_name\> [ \<arg1\> .. \<argN\> ] ]</td>
  103. <td>
  104. Without parameters this command shows the list of available
  105. result functions and their optional parameters.
  106. If however a result function name is given then this result
  107. function (and the given parameters) are added to the list of
  108. active result functions. They are executed on program exit and
  109. used to generate e.g. a CSV file containing the profile results.
  110. </td>
  111. </tr><tr>
  112. <!---------------------------------->
  113. <td valign=top>caller</td>
  114. <td valign=top>[ (+|-) ]</td>
  115. <td>
  116. Enables/disables recording of caller information while
  117. performing function level profiling. Turned off by default
  118. since CPU hit is non-zero.
  119. </td>
  120. </tr><tr>
  121. <!---------------------------------->
  122. <td valign=top>clear</td>
  123. <td valign=top></td>
  124. <td>
  125. Clears the profile inclusion/exclusion list.
  126. </td>
  127. </tr><tr>
  128. <!---------------------------------->
  129. <td valign=top>add</td>
  130. <td valign=top>(+|-) \<pattern\></td>
  131. <td>
  132. Adds a pattern to the profile list. By default all
  133. profile ranges are disabled. Each new range is then checked
  134. against all pattern in this list. If a match is found the
  135. active/inactive state is modified accordingly (+ for active,
  136. - for inactive). The final state is always the last match.
  137. </td>
  138. </tr><tr>
  139. <!---------------------------------->
  140. <td valign=top>view</td>
  141. <td valign=top></td>
  142. <td>
  143. Shows the active pattern list.
  144. </td>
  145. <!-- keep this as template for new commands -->
  146. </tr><tr>
  147. <!---------------------------------->
  148. <td valign=top></td>
  149. <td valign=top></td>
  150. <td>
  151. </td>
  152. </tr></table>
  153. */
  154. #endif // PROFILE_DOC_H