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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>GRPC Core: src/core/census/operation.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">GRPC Core
 <span id="projectnumber">0.11.0.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_aebb8dcc11953d78e620bbef0b9e2183.html">core</a></li><li class="navelem"><a class="el" href="dir_63ea090b1bf0393f23b745b651ae7f2b.html">census</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">operation.c File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include <<a class="el" href="census_8h_source.html">grpc/census.h</a>></code><br/>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a71b2afd7a1663c2a716af7242895442b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcensus__timestamp.html">census_timestamp</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="operation_8c.html#a71b2afd7a1663c2a716af7242895442b">census_start_rpc_op_timestamp</a> (void)</td></tr>
<tr class="memdesc:a71b2afd7a1663c2a716af7242895442b"><td class="mdescLeft"> </td><td class="mdescRight">Mark the beginning of an RPC operation. <a href="#a71b2afd7a1663c2a716af7242895442b">More...</a><br/></td></tr>
<tr class="separator:a71b2afd7a1663c2a716af7242895442b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0f2a69b151eac68f3c50806d2162d9f4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcensus__context.html">census_context</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="operation_8c.html#a0f2a69b151eac68f3c50806d2162d9f4">census_start_client_rpc_op</a> (const <a class="el" href="structcensus__context.html">census_context</a> *context, <a class="el" href="port__platform_8h.html#a71edab4bc3421f129764e5cb342f7181">gpr_int64</a> rpc_name_id, const <a class="el" href="structcensus__rpc__name__info.html">census_rpc_name_info</a> *rpc_name_info, const char *peer, int trace_mask, const <a class="el" href="structcensus__timestamp.html">census_timestamp</a> *start_time)</td></tr>
<tr class="memdesc:a0f2a69b151eac68f3c50806d2162d9f4"><td class="mdescLeft"> </td><td class="mdescRight">Start a client rpc operation. <a href="#a0f2a69b151eac68f3c50806d2162d9f4">More...</a><br/></td></tr>
<tr class="separator:a0f2a69b151eac68f3c50806d2162d9f4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab7014fb10de411a91588f05658148177"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcensus__context.html">census_context</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="operation_8c.html#ab7014fb10de411a91588f05658148177">census_start_server_rpc_op</a> (const char *buffer, <a class="el" href="port__platform_8h.html#a71edab4bc3421f129764e5cb342f7181">gpr_int64</a> rpc_name_id, const <a class="el" href="structcensus__rpc__name__info.html">census_rpc_name_info</a> *rpc_name_info, const char *peer, int trace_mask, <a class="el" href="structcensus__timestamp.html">census_timestamp</a> *start_time)</td></tr>
<tr class="memdesc:ab7014fb10de411a91588f05658148177"><td class="mdescLeft"> </td><td class="mdescRight">Start a server RPC operation. <a href="#ab7014fb10de411a91588f05658148177">More...</a><br/></td></tr>
<tr class="separator:ab7014fb10de411a91588f05658148177"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a14287fdb8adc322c1801435eb121e642"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcensus__context.html">census_context</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="operation_8c.html#a14287fdb8adc322c1801435eb121e642">census_start_op</a> (<a class="el" href="structcensus__context.html">census_context</a> *context, const char *family, const char *name, int trace_mask)</td></tr>
<tr class="memdesc:a14287fdb8adc322c1801435eb121e642"><td class="mdescLeft"> </td><td class="mdescRight">Start a new, non-RPC operation. <a href="#a14287fdb8adc322c1801435eb121e642">More...</a><br/></td></tr>
<tr class="separator:a14287fdb8adc322c1801435eb121e642"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a97a3300020cdacd7149e0efae9f5541e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="operation_8c.html#a97a3300020cdacd7149e0efae9f5541e">census_end_op</a> (<a class="el" href="structcensus__context.html">census_context</a> *context, int status)</td></tr>
<tr class="memdesc:a97a3300020cdacd7149e0efae9f5541e"><td class="mdescLeft"> </td><td class="mdescRight">End an operation started by any of the census_start_*_op*() calls. <a href="#a97a3300020cdacd7149e0efae9f5541e">More...</a><br/></td></tr>
<tr class="separator:a97a3300020cdacd7149e0efae9f5541e"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a97a3300020cdacd7149e0efae9f5541e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void census_end_op </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structcensus__context.html">census_context</a> * </td>
<td class="paramname"><em>context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>status</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>End an operation started by any of the census_start_*_op*() calls. </p>
<p>The context used in this call will no longer be valid once this function completes.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">context</td><td>Context associated with operation which is ending. </td></tr>
<tr><td class="paramname">status</td><td>status associated with the operation. Not interpreted by census. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a0f2a69b151eac68f3c50806d2162d9f4"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structcensus__context.html">census_context</a>* census_start_client_rpc_op </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structcensus__context.html">census_context</a> * </td>
<td class="paramname"><em>context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="port__platform_8h.html#a71edab4bc3421f129764e5cb342f7181">gpr_int64</a> </td>
<td class="paramname"><em>rpc_name_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="structcensus__rpc__name__info.html">census_rpc_name_info</a> * </td>
<td class="paramname"><em>rpc_name_info</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>peer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>trace_mask</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="structcensus__timestamp.html">census_timestamp</a> * </td>
<td class="paramname"><em>start_time</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Start a client rpc operation. </p>
<p>This function should be called as early in the client RPC path as possible. This function will create a new context. If the context argument is non-null, then the new context will inherit all its properties, with the following changes:</p>
<ul>
<li>create a new operation ID for the new context, marking it as a child of the previous operation.</li>
<li>use the new RPC path and peer information for tracing and stats collection purposes, rather than those from the original context</li>
</ul>
<p>If the context argument is NULL, then a new root context is created. This is particularly important for tracing purposes (the trace spans generated will be unassociated with any other trace spans, except those downstream). The trace_mask will be used for tracing operations associated with the new context.</p>
<p>In some RPC systems (e.g. where load balancing is used), peer information may not be available at the time the operation starts. In this case, use a NULL value for peer, and set it later using the <a class="el" href="census_8h.html#a06407a753c261626b4e25c4f6fe0b840" title="Add peer information to a context representing a client RPC operation. ">census_set_rpc_client_peer()</a> function.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">context</td><td>The parent context. Can be NULL. </td></tr>
<tr><td class="paramname">rpc_name_id</td><td>The rpc name identifier to be associated with this RPC. </td></tr>
<tr><td class="paramname">rpc_name_info</td><td>Used to decode rpc_name_id. </td></tr>
<tr><td class="paramname">peer</td><td>RPC peer. If not available at the time, NULL can be used, and a later <a class="el" href="census_8h.html#a06407a753c261626b4e25c4f6fe0b840" title="Add peer information to a context representing a client RPC operation. ">census_set_rpc_client_peer()</a> call made. </td></tr>
<tr><td class="paramname">trace_mask</td><td>An OR of census_trace_mask_values values. Only used in the creation of a new root context (context == NULL). </td></tr>
<tr><td class="paramname">start_time</td><td>A timestamp returned from <a class="el" href="census_8h.html#a71b2afd7a1663c2a716af7242895442b" title="Mark the beginning of an RPC operation. ">census_start_rpc_op_timestamp()</a>. Can be NULL. Used to set the true time the operation begins.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A new census context. </dd></dl>
</div>
</div>
<a class="anchor" id="a14287fdb8adc322c1801435eb121e642"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structcensus__context.html">census_context</a>* census_start_op </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structcensus__context.html">census_context</a> * </td>
<td class="paramname"><em>context</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>family</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>trace_mask</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Start a new, non-RPC operation. </p>
<p>In general, this function works very similarly to census_start_client_rpc_op, with the primary difference being the replacement of host/path information with the more generic family/name tags. If the context argument is non-null, then the new context will inherit all its properties, with the following changes:</p>
<ul>
<li>create a new operation ID for the new context, marking it as a child of the previous operation.</li>
<li>use the family and name information for tracing and stats collection purposes, rather than those from the original context</li>
</ul>
<p>If the context argument is NULL, then a new root context is created. This is particularly important for tracing purposes (the trace spans generated will be unassociated with any other trace spans, except those downstream). The trace_mask will be used for tracing operations associated with the new context.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">context</td><td>The base context. Can be NULL. </td></tr>
<tr><td class="paramname">family</td><td>Family name to associate with the trace </td></tr>
<tr><td class="paramname">name</td><td>Name within family to associated with traces/stats </td></tr>
<tr><td class="paramname">trace_mask</td><td>An OR of census_trace_mask_values values. Only used if context is NULL.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A new census context. </dd></dl>
</div>
</div>
<a class="anchor" id="a71b2afd7a1663c2a716af7242895442b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structcensus__timestamp.html">census_timestamp</a> census_start_rpc_op_timestamp </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Mark the beginning of an RPC operation. </p>
<p>The information required to call the functions to record the start of RPC operations (both client and server) may not be callable at the true start time of the operation, due to information not being available (e.g. the census context data will not be available in a server RPC until at least initial metadata has been processed). To ensure correct CPU accounting and latency recording, RPC systems can call this function to get the timestamp of operation beginning. This can later be used as an argument to census_start_{client,server}_rpc_op(). NB: for correct CPU accounting, the system must guarantee that the same thread is used for all request processing after this function is called.</p>
<dl class="section return"><dt>Returns</dt><dd>A timestamp representing the operation start time. </dd></dl>
</div>
</div>
<a class="anchor" id="ab7014fb10de411a91588f05658148177"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structcensus__context.html">census_context</a>* census_start_server_rpc_op </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="port__platform_8h.html#a71edab4bc3421f129764e5cb342f7181">gpr_int64</a> </td>
<td class="paramname"><em>rpc_name_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="structcensus__rpc__name__info.html">census_rpc_name_info</a> * </td>
<td class="paramname"><em>rpc_name_info</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>peer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>trace_mask</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structcensus__timestamp.html">census_timestamp</a> * </td>
<td class="paramname"><em>start_time</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Start a server RPC operation. </p>
<p>Returns a new context to be used in future census calls. If buffer is non-NULL, then the buffer contents should represent the client context, as generated by <a class="el" href="census_8h.html#ad9a7d3170ecf720e1b22a4f255605748">census_context_serialize()</a>. If buffer is NULL, a new root context is created.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">buffer</td><td>Buffer containing bytes output from <a class="el" href="census_8h.html#ad9a7d3170ecf720e1b22a4f255605748">census_context_serialize()</a>. </td></tr>
<tr><td class="paramname">rpc_name_id</td><td>The rpc name identifier to be associated with this RPC. </td></tr>
<tr><td class="paramname">rpc_name_info</td><td>Used to decode rpc_name_id. </td></tr>
<tr><td class="paramname">peer</td><td>RPC peer. </td></tr>
<tr><td class="paramname">trace_mask</td><td>An OR of census_trace_mask_values values. Only used in the creation of a new root context (buffer == NULL). </td></tr>
<tr><td class="paramname">start_time</td><td>A timestamp returned from <a class="el" href="census_8h.html#a71b2afd7a1663c2a716af7242895442b" title="Mark the beginning of an RPC operation. ">census_start_rpc_op_timestamp()</a>. Can be NULL. Used to set the true time the operation begins.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A new census context. </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Sep 3 2015 09:44:13 for GRPC Core by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>
|