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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Hardware Locality (hwloc): Converting between Object Types and Attributes, and Strings</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="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 id="projectrow">
<td id="projectalign">
<div id="projectname">Hardware Locality (hwloc)<span id="projectnumber"> 2.12.2</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() {
initMenu('',false,false,'search.php','Search');
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">Converting between Object Types and Attributes, and Strings</div></div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga6a38b931e5d45e8af4323a169482fe39" id="r_ga6a38b931e5d45e8af4323a169482fe39"><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00168.html#ga6a38b931e5d45e8af4323a169482fe39">hwloc_obj_type_string</a> (<a class="el" href="a00164.html#gacd37bb612667dc437d66bfb175a8dc55">hwloc_obj_type_t</a> type)</td></tr>
<tr class="separator:ga6a38b931e5d45e8af4323a169482fe39"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gadb8765c260edea80c52cd06a76639ba4" id="r_gadb8765c260edea80c52cd06a76639ba4"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00168.html#gadb8765c260edea80c52cd06a76639ba4">hwloc_obj_type_snprintf</a> (char *restrict string, size_t size, <a class="el" href="a00165.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> obj, int verbose)</td></tr>
<tr class="separator:gadb8765c260edea80c52cd06a76639ba4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga870e876931c282a1c7aee2f031912ce3" id="r_ga870e876931c282a1c7aee2f031912ce3"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00168.html#ga870e876931c282a1c7aee2f031912ce3">hwloc_obj_attr_snprintf</a> (char *restrict string, size_t size, <a class="el" href="a00165.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> obj, const char *restrict separator, int verbose)</td></tr>
<tr class="separator:ga870e876931c282a1c7aee2f031912ce3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga510f21b066fba2dab12b8c9b173b1dfd" id="r_ga510f21b066fba2dab12b8c9b173b1dfd"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00168.html#ga510f21b066fba2dab12b8c9b173b1dfd">hwloc_type_sscanf</a> (const char *string, <a class="el" href="a00164.html#gacd37bb612667dc437d66bfb175a8dc55">hwloc_obj_type_t</a> *typep, union <a class="el" href="a00224.html">hwloc_obj_attr_u</a> *attrp, size_t attrsize)</td></tr>
<tr class="separator:ga510f21b066fba2dab12b8c9b173b1dfd"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga52c63cd7203e55b804c1314affc9bd12" id="r_ga52c63cd7203e55b804c1314affc9bd12"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="a00168.html#ga52c63cd7203e55b804c1314affc9bd12">hwloc_type_sscanf_as_depth</a> (const char *string, <a class="el" href="a00164.html#gacd37bb612667dc437d66bfb175a8dc55">hwloc_obj_type_t</a> *typep, <a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> topology, int *depthp)</td></tr>
<tr class="separator:ga52c63cd7203e55b804c1314affc9bd12"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga870e876931c282a1c7aee2f031912ce3" name="ga870e876931c282a1c7aee2f031912ce3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga870e876931c282a1c7aee2f031912ce3">◆ </a></span>hwloc_obj_attr_snprintf()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_obj_attr_snprintf </td>
<td>(</td>
<td class="paramtype">char *restrict </td>
<td class="paramname"><em>string</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00165.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> </td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *restrict </td>
<td class="paramname"><em>separator</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>verbose</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Stringify the attributes of a given topology object into a human-readable form. </p>
<p>Attribute values are separated by <code>separator</code>.</p>
<p>Only the major attributes are printed in non-verbose mode.</p>
<p>If <code>size</code> is 0, <code>string</code> may safely be <code>NULL</code>.</p>
<dl class="section return"><dt>Returns</dt><dd>the number of characters that were actually written if not truncating, or that would have been written (not including the ending <code>\0</code>). </dd></dl>
</div>
</div>
<a id="gadb8765c260edea80c52cd06a76639ba4" name="gadb8765c260edea80c52cd06a76639ba4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gadb8765c260edea80c52cd06a76639ba4">◆ </a></span>hwloc_obj_type_snprintf()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_obj_type_snprintf </td>
<td>(</td>
<td class="paramtype">char *restrict </td>
<td class="paramname"><em>string</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00165.html#ga79b8ab56877ef99ac59b833203391c7d">hwloc_obj_t</a> </td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>verbose</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Stringify the type of a given topology object into a human-readable form. </p>
<p>Contrary to <a class="el" href="a00168.html#ga6a38b931e5d45e8af4323a169482fe39" title="Return a constant stringified object type.">hwloc_obj_type_string()</a>, this function includes object-specific attributes (such as the Group depth, the Bridge type, or OS device type) in the output, and it requires the caller to provide the output buffer.</p>
<p>The output is guaranteed to be the same for all objects of a same topology level.</p>
<p>If <code>verbose</code> is 1, longer type names are used, e.g. L1Cache instead of L1.</p>
<p>The output string may be parsed back by <a class="el" href="a00168.html#ga510f21b066fba2dab12b8c9b173b1dfd" title="Return an object type and attributes from a type string.">hwloc_type_sscanf()</a>.</p>
<p>If <code>size</code> is 0, <code>string</code> may safely be <code>NULL</code>.</p>
<dl class="section return"><dt>Returns</dt><dd>the number of characters that were actually written if not truncating, or that would have been written (not including the ending <code>\0</code>). </dd></dl>
</div>
</div>
<a id="ga6a38b931e5d45e8af4323a169482fe39" name="ga6a38b931e5d45e8af4323a169482fe39"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6a38b931e5d45e8af4323a169482fe39">◆ </a></span>hwloc_obj_type_string()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char * hwloc_obj_type_string </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00164.html#gacd37bb612667dc437d66bfb175a8dc55">hwloc_obj_type_t</a> </td>
<td class="paramname"><em>type</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return a constant stringified object type. </p>
<p>This function is the basic way to convert a generic type into a string. The output string may be parsed back by <a class="el" href="a00168.html#ga510f21b066fba2dab12b8c9b173b1dfd" title="Return an object type and attributes from a type string.">hwloc_type_sscanf()</a>.</p>
<p><a class="el" href="a00168.html#gadb8765c260edea80c52cd06a76639ba4" title="Stringify the type of a given topology object into a human-readable form.">hwloc_obj_type_snprintf()</a> may return a more precise output for a specific object, but it requires the caller to provide the output buffer.</p>
<dl class="section return"><dt>Returns</dt><dd>A constant string containing the object type name or <code>"Unknown"</code>. </dd></dl>
</div>
</div>
<a id="ga510f21b066fba2dab12b8c9b173b1dfd" name="ga510f21b066fba2dab12b8c9b173b1dfd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga510f21b066fba2dab12b8c9b173b1dfd">◆ </a></span>hwloc_type_sscanf()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_type_sscanf </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>string</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00164.html#gacd37bb612667dc437d66bfb175a8dc55">hwloc_obj_type_t</a> * </td>
<td class="paramname"><em>typep</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">union <a class="el" href="a00224.html">hwloc_obj_attr_u</a> * </td>
<td class="paramname"><em>attrp</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>attrsize</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return an object type and attributes from a type string. </p>
<p>Convert strings such as "Package" or "L1iCache" into the corresponding types. Matching is case-insensitive, and only the first letters are actually required to match.</p>
<p>The matched object type is set in <code>typep</code> (which cannot be <code>NULL</code>).</p>
<p>Type-specific attributes, for instance Cache type, Cache depth, Group depth, Bridge type or OS Device type may be returned in <code>attrp</code>. Attributes that are not specified in the string (for instance "Group" without a depth, or "L2Cache" without a cache type) are set to -1.</p>
<p><code>attrp</code> is only filled if not <code>NULL</code> and if its size specified in <code>attrsize</code> is large enough. It should be at least as large as union <a class="el" href="a00224.html" title="Object type-specific Attributes.">hwloc_obj_attr_u</a>.</p>
<dl class="section return"><dt>Returns</dt><dd>0 if a type was correctly identified, otherwise -1.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This function is guaranteed to match any string returned by <a class="el" href="a00168.html#ga6a38b931e5d45e8af4323a169482fe39" title="Return a constant stringified object type.">hwloc_obj_type_string()</a> or <a class="el" href="a00168.html#gadb8765c260edea80c52cd06a76639ba4" title="Stringify the type of a given topology object into a human-readable form.">hwloc_obj_type_snprintf()</a>.</dd>
<dd>
This is an extended version of the now deprecated hwloc_obj_type_sscanf(). </dd></dl>
</div>
</div>
<a id="ga52c63cd7203e55b804c1314affc9bd12" name="ga52c63cd7203e55b804c1314affc9bd12"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga52c63cd7203e55b804c1314affc9bd12">◆ </a></span>hwloc_type_sscanf_as_depth()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int hwloc_type_sscanf_as_depth </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>string</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00164.html#gacd37bb612667dc437d66bfb175a8dc55">hwloc_obj_type_t</a> * </td>
<td class="paramname"><em>typep</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="a00166.html#ga9d1e76ee15a7dee158b786c30b6a6e38">hwloc_topology_t</a> </td>
<td class="paramname"><em>topology</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>depthp</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return an object type and its level depth from a type string. </p>
<p>Convert strings such as "Package" or "L1iCache" into the corresponding types and return in <code>depthp</code> the depth of the corresponding level in the topology <code>topology</code>.</p>
<p>If no object of this type is present on the underlying architecture, <a class="el" href="a00167.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a> is returned.</p>
<p>If multiple such levels exist (for instance if giving Group without any depth), the function may return <a class="el" href="a00167.html#ggaf4e663cf42bbe20756b849c6293ef575ae99465995cacde6c210d5fc2e409798c" title="Objects of given type exist at different depth in the topology (only for Groups).">HWLOC_TYPE_DEPTH_MULTIPLE</a> instead.</p>
<p>The matched object type is set in <code>typep</code> if <code>typep</code> is non <code>NULL</code>.</p>
<dl class="section note"><dt>Note</dt><dd>This function is similar to <a class="el" href="a00168.html#ga510f21b066fba2dab12b8c9b173b1dfd" title="Return an object type and attributes from a type string.">hwloc_type_sscanf()</a> followed by <a class="el" href="a00167.html#ga8bec782e21be313750da70cf7428b374" title="Returns the depth of objects of type type.">hwloc_get_type_depth()</a> but it also automatically disambiguates multiple group levels etc.</dd>
<dd>
This function is guaranteed to match any string returned by <a class="el" href="a00168.html#ga6a38b931e5d45e8af4323a169482fe39" title="Return a constant stringified object type.">hwloc_obj_type_string()</a> or <a class="el" href="a00168.html#gadb8765c260edea80c52cd06a76639ba4" title="Stringify the type of a given topology object into a human-readable form.">hwloc_obj_type_snprintf()</a>. </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>
|