1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
|
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="rhythmbox-rb-debug">
<refmeta>
<refentrytitle role="top_of_page" id="rhythmbox-rb-debug.top_of_page">rb-debug</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>RHYTHMBOX Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>rb-debug</refname>
<refpurpose>debugging support functions</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>
<refsynopsisdiv id="rhythmbox-rb-debug.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>
<synopsis>
#define <link linkend="rb-debug">rb_debug</link> (...)
<link linkend="void">void</link> <link linkend="rb-debug-init">rb_debug_init</link> (<link linkend="gboolean">gboolean</link> debug);
<link linkend="void">void</link> <link linkend="rb-debug-init-match">rb_debug_init_match</link> (const <link linkend="char">char</link> *match);
<link linkend="gboolean">gboolean</link> <link linkend="rb-debug-matches">rb_debug_matches</link> (const <link linkend="char">char</link> *func,
const <link linkend="char">char</link> *file);
<link linkend="char">char</link>** <link linkend="rb-debug-get-args">rb_debug_get_args</link> (void);
<link linkend="void">void</link> <link linkend="rb-debug-stop-in-debugger">rb_debug_stop_in_debugger</link> (void);
typedef <link linkend="RBProfiler">RBProfiler</link>;
<link linkend="RBProfiler">RBProfiler</link>* <link linkend="rb-profiler-new">rb_profiler_new</link> (const <link linkend="char">char</link> *name);
<link linkend="void">void</link> <link linkend="rb-profiler-dump">rb_profiler_dump</link> (<link linkend="RBProfiler">RBProfiler</link> *profiler);
<link linkend="void">void</link> <link linkend="rb-profiler-reset">rb_profiler_reset</link> (<link linkend="RBProfiler">RBProfiler</link> *profiler);
<link linkend="void">void</link> <link linkend="rb-profiler-free">rb_profiler_free</link> (<link linkend="RBProfiler">RBProfiler</link> *profiler);
#define <link linkend="rb-profile-start">rb_profile_start</link> (msg)
#define <link linkend="rb-profile-end">rb_profile_end</link> (msg)
</synopsis>
</refsynopsisdiv>
<refsect1 id="rhythmbox-rb-debug.description" role="desc">
<title role="desc.title">Description</title>
<para>
In addition to a simple debug output system, we have two distinct
profiling mechanisms for timing sections of code.</para>
<para>
</para>
</refsect1>
<refsect1 id="rhythmbox-rb-debug.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="rb-debug" role="macro">
<title>rb_debug()</title>
<indexterm zone="rb-debug"><primary>rb_debug</primary></indexterm><programlisting>#define rb_debug(...)</programlisting>
<para>
If the call site function or file name matches the current debug output
settings, the message will be formatted and printed to standard error,
including a timestamp, the thread ID, the file and function names, and
the line number. A newline will be appended, so the format string shouldn't
include one.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>...</parameter> :</term>
<listitem><simpara> printf-style format string followed by any substitution values
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rb-debug-init" role="function">
<title>rb_debug_init ()</title>
<indexterm zone="rb-debug-init"><primary>rb_debug_init</primary></indexterm><programlisting><link linkend="void">void</link> rb_debug_init (<link linkend="gboolean">gboolean</link> debug);</programlisting>
<para>
Sets up debug output, with either all debug enabled
or none.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>debug</parameter> :</term>
<listitem><simpara> if TRUE, enable all debug output
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rb-debug-init-match" role="function">
<title>rb_debug_init_match ()</title>
<indexterm zone="rb-debug-init-match"><primary>rb_debug_init_match</primary></indexterm><programlisting><link linkend="void">void</link> rb_debug_init_match (const <link linkend="char">char</link> *match);</programlisting>
<para>
Sets up debug output, enabling debug output from file and function
names that contain the specified match string.
</para>
<para>
Also sets up a GLib log handler that will trigger a debugger
break for critical or warning level output if any debug output
at all is enabled.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>match</parameter> :</term>
<listitem><simpara> string to match functions and filenames against
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rb-debug-matches" role="function">
<title>rb_debug_matches ()</title>
<indexterm zone="rb-debug-matches"><primary>rb_debug_matches</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link> rb_debug_matches (const <link linkend="char">char</link> *func,
const <link linkend="char">char</link> *file);</programlisting>
<para>
</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>func</parameter> :</term>
<listitem><simpara> function to check
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>file</parameter> :</term>
<listitem><simpara> filename to check
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> TRUE if <parameter>func</parameter> or <parameter>file</parameter> match the current
debug output settings.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rb-debug-get-args" role="function">
<title>rb_debug_get_args ()</title>
<indexterm zone="rb-debug-get-args"><primary>rb_debug_get_args</primary></indexterm><programlisting><link linkend="char">char</link>** rb_debug_get_args (void);</programlisting>
<para>
Constructs arguments to pass to another process using
this debug output code that will produce the same debug output
settings.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> debug output arguments, must be freed with #<link linkend="g-strfreev"><function>g_strfreev()</function></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rb-debug-stop-in-debugger" role="function">
<title>rb_debug_stop_in_debugger ()</title>
<indexterm zone="rb-debug-stop-in-debugger"><primary>rb_debug_stop_in_debugger</primary></indexterm><programlisting><link linkend="void">void</link> rb_debug_stop_in_debugger (void);</programlisting>
<para>
Raises a SIGINT signal to get the attention of the debugger.
When not running under the debugger, we don't want to stop,
so we ignore the signal for just the moment that we raise it.</para>
<para>
</para></refsect2>
<refsect2 id="RBProfiler" role="typedef">
<title>RBProfiler</title>
<indexterm zone="RBProfiler"><primary>RBProfiler</primary></indexterm><programlisting>typedef struct RBProfiler RBProfiler;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="rb-profiler-new" role="function">
<title>rb_profiler_new ()</title>
<indexterm zone="rb-profiler-new"><primary>rb_profiler_new</primary></indexterm><programlisting><link linkend="RBProfiler">RBProfiler</link>* rb_profiler_new (const <link linkend="char">char</link> *name);</programlisting>
<para>
Creates a new profiler instance. This can be used to
time certain sections of code.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>name</parameter> :</term>
<listitem><simpara> profiler name
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> profiler instance
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rb-profiler-dump" role="function">
<title>rb_profiler_dump ()</title>
<indexterm zone="rb-profiler-dump"><primary>rb_profiler_dump</primary></indexterm><programlisting><link linkend="void">void</link> rb_profiler_dump (<link linkend="RBProfiler">RBProfiler</link> *profiler);</programlisting>
<para>
Produces debug output for the profiler instance,
showing the elapsed time.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>profiler</parameter> :</term>
<listitem><simpara> profiler instance
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rb-profiler-reset" role="function">
<title>rb_profiler_reset ()</title>
<indexterm zone="rb-profiler-reset"><primary>rb_profiler_reset</primary></indexterm><programlisting><link linkend="void">void</link> rb_profiler_reset (<link linkend="RBProfiler">RBProfiler</link> *profiler);</programlisting>
<para>
Resets the elapsed time for the profiler</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>profiler</parameter> :</term>
<listitem><simpara> profiler instance
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rb-profiler-free" role="function">
<title>rb_profiler_free ()</title>
<indexterm zone="rb-profiler-free"><primary>rb_profiler_free</primary></indexterm><programlisting><link linkend="void">void</link> rb_profiler_free (<link linkend="RBProfiler">RBProfiler</link> *profiler);</programlisting>
<para>
Frees the memory associated with a profiler instance.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>profiler</parameter> :</term>
<listitem><simpara> profiler instance to destroy
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rb-profile-start" role="macro">
<title>rb_profile_start()</title>
<indexterm zone="rb-profile-start"><primary>rb_profile_start</primary></indexterm><programlisting>#define rb_profile_start(msg)</programlisting>
<para>
Records a start point for profiling.
This profile mechanism operates by issuing file access
requests with filenames indicating the profile points.
Use 'strace -e access' to gather this information.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>msg</parameter> :</term>
<listitem><simpara> profile point message
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="rb-profile-end" role="macro">
<title>rb_profile_end()</title>
<indexterm zone="rb-profile-end"><primary>rb_profile_end</primary></indexterm><programlisting>#define rb_profile_end(msg)</programlisting>
<para>
Records an end point for profiling. See <parameter>rb_profile_start</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>msg</parameter> :</term>
<listitem><simpara> profile point message
</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>
</refentry>
|