summaryrefslogtreecommitdiffstats
path: root/runtime/docs/html/group__print.html
blob: f18a05bfe7e991b068bc76d0a6435eac777bd17f (plain)
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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>SystemTap: Print Buffer</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>Print Buffer</h1>Print Buffer Functions.  
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga8" doxytag="print::STP_PRINT_BUF_LEN"></a>
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__print.html#ga8">STP_PRINT_BUF_LEN</a>&nbsp;&nbsp;&nbsp;8000</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Size of buffer, not including terminating NULL. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga9" doxytag="print::TIMESTAMP_SIZE"></a>
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TIMESTAMP_SIZE</b>&nbsp;&nbsp;&nbsp;19</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga10" doxytag="print::STP_PRINT_BUF_START"></a>
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>STP_PRINT_BUF_START</b>&nbsp;&nbsp;&nbsp;(TIMESTAMP_SIZE + 1)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__print.html#ga11">_stp_print</a>(str)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Write a String or C string into the print buffer.  <a href="#ga11"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__print.html#ga2">_stp_print_flush</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Send the print buffer now.  <a href="#ga2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__print.html#ga3">_stp_printf</a> (const char *fmt,...)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Print into the print buffer.  <a href="#ga3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__print.html#ga4">_stp_vprintf</a> (const char *fmt, va_list args)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Print into the print buffer.  <a href="#ga4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__print.html#ga5">_stp_print_cstr</a> (const char *str)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Write a C string into the print buffer.  <a href="#ga5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__print.html#ga6">_stp_print_clear</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Clear the scratch buffer.  <a href="#ga6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__print.html#ga7">_stp_print_string</a> (String str)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Write a String into the print buffer.  <a href="#ga7"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Print Buffer Functions. 
<p>
The print buffer is for collecting output to send to the user daemon. This is a per-cpu static buffer. The buffer is sent when <a class="el" href="group__print.html#ga2">_stp_print_flush()</a> is called.<p>
The reason to do this is to allow multiple small prints to be combined then timestamped and sent together to stpd. It could flush automatically on newlines, but what about stack traces which span many lines? So try this and see how it works for us. <hr><h2>Define Documentation</h2>
<a class="anchor" name="ga11" doxytag="print.c::_stp_print"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">#define _stp_print          </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">str&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
<b>Value:</b><div class="fragment"><pre class="fragment">({                                                              \
          <span class="keywordflow">if</span> (__builtin_types_compatible_p (typeof (str), <span class="keywordtype">char</span>[])) {    \
                  <span class="keywordtype">char</span> *x = (<span class="keywordtype">char</span> *)str;                                \
                  <a class="code" href="group__print.html#ga5">_stp_print_cstr</a>(x);                                   \
          } <span class="keywordflow">else</span> {                                                      \
                  String x = (String)str;                               \
                  <a class="code" href="group__print.html#ga7">_stp_print_string</a>(x);                                 \
          }                                                             \
  })
</pre></div>Write a String or C string into the print buffer. 
<p>
This macro selects the proper function to call. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>str</em>&nbsp;</td><td>A String or C string (char *) </td></tr>
  </table>
</dl>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__print.html#ga5">_stp_print_cstr</a> <a class="el" href="group__print.html#ga7">_stp_print_string</a> </dd></dl>

<p>
Definition at line <a class="el" href="print_8c-source.html#l00188">188</a> of file <a class="el" href="print_8c-source.html">print.c</a>.    </td>
  </tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="ga6" doxytag="print.c::_stp_print_clear"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">char* _stp_print_clear           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Clear the scratch buffer. 
<p>
This function should be called before anything is written to the scratch buffer. Output will accumulate in the buffer until this function is called again. <dl compact><dt><b>Returns:</b></dt><dd>A pointer to the buffer. </dd></dl>

<p>
Definition at line <a class="el" href="print_8c-source.html#l00156">156</a> of file <a class="el" href="print_8c-source.html">print.c</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ga5" doxytag="print.c::_stp_print_cstr"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void _stp_print_cstr           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>str</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Write a C string into the print buffer. 
<p>
Copies a string into a print buffer. Safe because overflowing the buffer is not allowed. Size is limited by length of print buffer, <a class="el" href="group__print.html#ga8">STP_PRINT_BUF_LEN</a>. This is more efficient than using <a class="el" href="group__print.html#ga3">_stp_printf()</a> if you don't need fancy formatting.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>str</em>&nbsp;</td><td>A C string. </td></tr>
  </table>
</dl>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__print.html#ga11">_stp_print</a> </dd></dl>

<p>
Definition at line <a class="el" href="print_8c-source.html#l00138">138</a> of file <a class="el" href="print_8c-source.html">print.c</a>.
<p>
References <a class="el" href="print_8c-source.html#l00022">STP_PRINT_BUF_LEN</a>.
<p>
Referenced by <a class="el" href="print_8c-source.html#l00176">_stp_print_string()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ga2" doxytag="print.c::_stp_print_flush"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void _stp_print_flush           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Send the print buffer now. 
<p>
Output accumulates in the print buffer until this is called. Size is limited by length of print buffer, <a class="el" href="group__print.html#ga8">STP_PRINT_BUF_LEN</a>. 
<p>
Definition at line <a class="el" href="print_8c-source.html#l00065">65</a> of file <a class="el" href="print_8c-source.html">print.c</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ga7" doxytag="print.c::_stp_print_string"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void _stp_print_string           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">String&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>str</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Write a String into the print buffer. 
<p>
Copies a String into a print buffer. Safe because overflowing the buffer is not allowed. Size is limited by length of print buffer, <a class="el" href="group__print.html#ga8">STP_PRINT_BUF_LEN</a>. This is more efficient than using <a class="el" href="group__print.html#ga3">_stp_printf()</a> if you don't need fancy formatting.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>str</em>&nbsp;</td><td>A String. </td></tr>
  </table>
</dl>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__print.html#ga11">_stp_print</a> </dd></dl>

<p>
Definition at line <a class="el" href="print_8c-source.html#l00176">176</a> of file <a class="el" href="print_8c-source.html">print.c</a>.
<p>
References <a class="el" href="print_8c-source.html#l00138">_stp_print_cstr()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ga3" doxytag="print.c::_stp_printf"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void _stp_printf           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap> <em>fmt</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>&nbsp;</td>
          <td class="mdname" nowrap> <em>...</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print into the print buffer. 
<p>
Like printf, except output goes to the print buffer. Safe because overflowing the buffer is not allowed. Size is limited by length of print buffer, <a class="el" href="group__print.html#ga8">STP_PRINT_BUF_LEN</a>.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>fmt</em>&nbsp;</td><td>A printf-style format string followed by a variable number of args. </td></tr>
  </table>
</dl>
<dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__print.html#ga2">_stp_print_flush()</a> </dd></dl>

<p>
Definition at line <a class="el" href="print_8c-source.html#l00099">99</a> of file <a class="el" href="print_8c-source.html">print.c</a>.
<p>
References <a class="el" href="print_8c-source.html#l00022">STP_PRINT_BUF_LEN</a>.
<p>
Referenced by <a class="el" href="sym_8c-source.html#l00054">_stp_symbol_print()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="ga4" doxytag="print.c::_stp_vprintf"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">void _stp_vprintf           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname" nowrap> <em>fmt</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>va_list&nbsp;</td>
          <td class="mdname" nowrap> <em>args</em></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Print into the print buffer. 
<p>
Use this if your function already has a va_list. You probably want <a class="el" href="group__print.html#ga3">_stp_printf()</a>. 
<p>
Definition at line <a class="el" href="print_8c-source.html#l00117">117</a> of file <a class="el" href="print_8c-source.html">print.c</a>.
<p>
References <a class="el" href="print_8c-source.html#l00022">STP_PRINT_BUF_LEN</a>.    </td>
  </tr>
</table>
</body></html>