summaryrefslogtreecommitdiff
path: root/libstdc++-v3/doc/html/manual/bk01pt03ch19s06.html
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/doc/html/manual/bk01pt03ch19s06.html
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libstdc++-v3/doc/html/manual/bk01pt03ch19s06.html')
-rw-r--r--libstdc++-v3/doc/html/manual/bk01pt03ch19s06.html68
1 files changed, 68 insertions, 0 deletions
diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch19s06.html b/libstdc++-v3/doc/html/manual/bk01pt03ch19s06.html
new file mode 100644
index 000000000..ddcc7f570
--- /dev/null
+++ b/libstdc++-v3/doc/html/manual/bk01pt03ch19s06.html
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Developer Information</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/><meta name="keywords" content="&#10; C++&#10; , &#10; library&#10; , &#10; profile&#10; "/><meta name="keywords" content="&#10; ISO C++&#10; , &#10; library&#10; "/><link rel="home" href="../spine.html" title="The GNU C++ Library"/><link rel="up" href="profile_mode.html" title="Chapter 19. Profile Mode"/><link rel="prev" href="bk01pt03ch19s05.html" title="Implementation Issues"/><link rel="next" href="bk01pt03ch19s07.html" title="Diagnostics"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Developer Information</th></tr><tr><td align="left"><a accesskey="p" href="bk01pt03ch19s05.html">Prev</a> </td><th width="60%" align="center">Chapter 19. Profile Mode</th><td align="right"> <a accesskey="n" href="bk01pt03ch19s07.html">Next</a></td></tr></table><hr/></div><div class="section" title="Developer Information"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.profile_mode.developer"/>Developer Information</h2></div></div></div><div class="section" title="Big Picture"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.profile_mode.developer.bigpic"/>Big Picture</h3></div></div></div><p>The profile mode headers are included with
+ <code class="code">-D_GLIBCXX_PROFILE</code> through preprocessor directives in
+ <code class="code">include/std/*</code>.
+ </p><p>Instrumented implementations are provided in
+ <code class="code">include/profile/*</code>. All instrumentation hooks are macros
+ defined in <code class="code">include/profile/profiler.h</code>.
+ </p><p>All the implementation of the instrumentation hooks is in
+ <code class="code">include/profile/impl/*</code>. Although all the code gets included,
+ thus is publicly visible, only a small number of functions are called from
+ outside this directory. All calls to hook implementations must be
+ done through macros defined in <code class="code">profiler.h</code>. The macro
+ must ensure (1) that the call is guarded against reentrance and
+ (2) that the call can be turned off at compile time using a
+ <code class="code">-D_GLIBCXX_PROFILE_...</code> compiler option.
+ </p></div><div class="section" title="How To Add A Diagnostic"><div class="titlepage"><div><div><h3 class="title"><a id="manual.ext.profile_mode.developer.howto"/>How To Add A Diagnostic</h3></div></div></div><p>Let's say the diagnostic name is "magic".
+ </p><p>If you need to instrument a header not already under
+ <code class="code">include/profile/*</code>, first edit the corresponding header
+ under <code class="code">include/std/</code> and add a preprocessor directive such
+ as the one in <code class="code">include/std/vector</code>:
+</p><pre class="programlisting">
+#ifdef _GLIBCXX_PROFILE
+# include &lt;profile/vector&gt;
+#endif
+</pre><p>
+ </p><p>If the file you need to instrument is not yet under
+ <code class="code">include/profile/</code>, make a copy of the one in
+ <code class="code">include/debug</code>, or the main implementation.
+ You'll need to include the main implementation and inherit the classes
+ you want to instrument. Then define the methods you want to instrument,
+ define the instrumentation hooks and add calls to them.
+ Look at <code class="code">include/profile/vector</code> for an example.
+ </p><p>Add macros for the instrumentation hooks in
+ <code class="code">include/profile/impl/profiler.h</code>.
+ Hook names must start with <code class="code">__profcxx_</code>.
+ Make sure they transform
+ in no code with <code class="code">-D_NO_GLBICXX_PROFILE_MAGIC</code>.
+ Make sure all calls to any method in namespace <code class="code">__gnu_profile</code>
+ is protected against reentrance using macro
+ <code class="code">_GLIBCXX_PROFILE_REENTRANCE_GUARD</code>.
+ All names of methods in namespace <code class="code">__gnu_profile</code> called from
+ <code class="code">profiler.h</code> must start with <code class="code">__trace_magic_</code>.
+ </p><p>Add the implementation of the diagnostic.
+ </p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p>
+ Create new file <code class="code">include/profile/impl/profiler_magic.h</code>.
+ </p></li><li class="listitem"><p>
+ Define class <code class="code">__magic_info: public __object_info_base</code>.
+ This is the representation of a line in the object table.
+ The <code class="code">__merge</code> method is used to aggregate information
+ across all dynamic instances created at the same call context.
+ The <code class="code">__magnitude</code> must return the estimation of the benefit
+ as a number of small operations, e.g., number of words copied.
+ The <code class="code">__write</code> method is used to produce the raw trace.
+ The <code class="code">__advice</code> method is used to produce the advice string.
+ </p></li><li class="listitem"><p>
+ Define class <code class="code">__magic_stack_info: public __magic_info</code>.
+ This defines the content of a line in the stack table.
+ </p></li><li class="listitem"><p>
+ Define class <code class="code">__trace_magic: public __trace_base&lt;__magic_info,
+ __magic_stack_info&gt;</code>.
+ It defines the content of the trace associated with this diagnostic.
+ </p></li></ul></div><p>
+ </p><p>Add initialization and reporting calls in
+ <code class="code">include/profile/impl/profiler_trace.h</code>. Use
+ <code class="code">__trace_vector_to_list</code> as an example.
+ </p><p>Add documentation in file <code class="code">doc/xml/manual/profile_mode.xml</code>.
+ </p></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="bk01pt03ch19s05.html">Prev</a> </td><td align="center"><a accesskey="u" href="profile_mode.html">Up</a></td><td align="right"> <a accesskey="n" href="bk01pt03ch19s07.html">Next</a></td></tr><tr><td align="left" valign="top">Implementation Issues </td><td align="center"><a accesskey="h" href="../spine.html">Home</a></td><td align="right" valign="top"> Diagnostics</td></tr></table></div></body></html>