<!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"/> <title>libtopology: include/topology.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.3 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">libtopology</div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></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> <div class="header"> <div class="headertitle"> <h1>include/topology.h</h1> </div> </div> <div class="contents"> <a href="topology_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> * libtopology - a library for discovering Linux system topology</span> <a name="l00003"></a>00003 <span class="comment"> *</span> <a name="l00004"></a>00004 <span class="comment"> * Copyright 2008 Nathan Lynch, IBM Corporation</span> <a name="l00005"></a>00005 <span class="comment"> *</span> <a name="l00006"></a>00006 <span class="comment"> * This library is free software; you can redistribute it and/or</span> <a name="l00007"></a>00007 <span class="comment"> * modify it under the terms of the GNU Lesser General Public License</span> <a name="l00008"></a>00008 <span class="comment"> * version 2.1 as published by the Free Software Foundation.</span> <a name="l00009"></a>00009 <span class="comment"> *</span> <a name="l00010"></a>00010 <span class="comment"> * This library is distributed in the hope that it will be useful, but</span> <a name="l00011"></a>00011 <span class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00012"></a>00012 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00013"></a>00013 <span class="comment"> * Lesser General Public License for more details.</span> <a name="l00014"></a>00014 <span class="comment"> *</span> <a name="l00015"></a>00015 <span class="comment"> * You should have received a copy of the GNU Lesser General Public</span> <a name="l00016"></a>00016 <span class="comment"> * License along with this library; if not, write to the Free Software</span> <a name="l00017"></a>00017 <span class="comment"> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA</span> <a name="l00018"></a>00018 <span class="comment"> * 02110-1301 USA</span> <a name="l00019"></a>00019 <span class="comment"> */</span> <a name="l00020"></a>00020 <a name="l00027"></a>00027 <span class="preprocessor">#ifndef _TOPOLOGY_H_</span> <a name="l00028"></a>00028 <span class="preprocessor"></span><span class="preprocessor">#define _TOPOLOGY_H_</span> <a name="l00029"></a>00029 <span class="preprocessor"></span> <a name="l00030"></a>00030 <span class="preprocessor">#ifdef __cplusplus</span> <a name="l00031"></a>00031 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> { <a name="l00032"></a>00032 <span class="preprocessor">#endif</span> <a name="l00033"></a>00033 <span class="preprocessor"></span> <a name="l00034"></a>00034 <span class="preprocessor">#ifndef LIBTOPOLOGY_DOXYGEN_SKIP</span> <a name="l00035"></a>00035 <span class="preprocessor"></span> <a name="l00036"></a>00036 <span class="preprocessor">#include <sched.h></span> <span class="comment">/* for cpu_set_t */</span> <a name="l00037"></a>00037 <a name="l00038"></a>00038 <span class="preprocessor">#endif </span><span class="comment">/* LIBTOPOLOGY_DOXYGEN_SKIP */</span> <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> topo_context_t; <a name="l00041"></a>00041 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> topo_procent_t; <a name="l00042"></a>00042 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> topo_device_t; <a name="l00043"></a>00043 <a name="l00044"></a>00044 <span class="keyword">typedef</span> <span class="keyword">enum</span> topology_level { <a name="l00045"></a>00045 TOPOLOGY_THREAD = 1, <a name="l00046"></a>00046 TOPOLOGY_CORE, <a name="l00047"></a>00047 TOPOLOGY_PACKAGE, <a name="l00048"></a>00048 TOPOLOGY_NODE, <a name="l00049"></a>00049 TOPOLOGY_SYSTEM, <a name="l00050"></a>00050 } topo_level_t; <a name="l00051"></a>00051 <a name="l00069"></a>00069 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="topology_8h.html#a31820c2cd443c201e3c0b49bbf95f5e8">topology_init_context</a>(topo_context_t *ctx, topo_procent_t *system); <a name="l00070"></a>00070 <a name="l00084"></a>00084 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="topology_8h.html#a8b138258fae846a297f4ebd8e9ed18be">topology_free_context</a>(topo_context_t ctx); <a name="l00085"></a>00085 <a name="l00106"></a>00106 <span class="keyword">extern</span> <span class="keywordtype">size_t</span> <a class="code" href="topology_8h.html#ae7dfacf839321a6514334a3265504ffa">topology_sizeof_cpumask</a>(topo_context_t ctx); <a name="l00107"></a>00107 <a name="l00125"></a>00125 <span class="keyword">extern</span> topo_procent_t <a name="l00126"></a>00126 <a class="code" href="topology_8h.html#a447457295957e58b67ecf8b0f174091b">topology_traverse</a>(topo_procent_t start, <a name="l00127"></a>00127 topo_procent_t iter, <a name="l00128"></a>00128 topo_level_t to_level); <a name="l00141"></a>00141 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="topology_8h.html#aad9b02723a0afcd23d20c7b150064eda">topology_procent_cpumask</a>(topo_procent_t ent, cpu_set_t *dest); <a name="l00142"></a>00142 <a name="l00159"></a>00159 <span class="keyword">extern</span> topo_device_t <a name="l00160"></a>00160 <a class="code" href="topology_8h.html#abb206137614a1770cd2301561b594444">topology_find_device_by_type</a>(topo_context_t ctx, <a name="l00161"></a>00161 topo_device_t prev, <a name="l00162"></a>00162 <span class="keyword">const</span> <span class="keywordtype">char</span> *type); <a name="l00163"></a>00163 <a name="l00164"></a>00164 <a name="l00177"></a>00177 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="topology_8h.html#a777a9a669c27efa683a309e4d9149a64">topology_device_cpumask</a>(topo_device_t dev, cpu_set_t *dest); <a name="l00178"></a>00178 <a name="l00191"></a>00191 <span class="keyword">extern</span> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a name="l00192"></a>00192 <a class="code" href="topology_8h.html#ac70442a64bdcec2a6bf70025fc06f7c0">topology_device_get_attribute</a>(topo_device_t dev, <span class="keyword">const</span> <span class="keywordtype">char</span> *name); <a name="l00193"></a>00193 <a name="l00203"></a><a class="code" href="topology_8h.html#ae6895ae6d85c34bb346fdd222c9a8c03">00203</a> <span class="preprocessor">#define topology_for_each_device_of_type(ctx, dev, type) \</span> <a name="l00204"></a>00204 <span class="preprocessor"> for ((dev) = topology_find_device_by_type((ctx), (topo_device_t)0, (type)); \</span> <a name="l00205"></a>00205 <span class="preprocessor"> (dev) != 0; \</span> <a name="l00206"></a>00206 <span class="preprocessor"> (dev) = topology_find_device_by_type((ctx), (dev), (type)))</span> <a name="l00207"></a>00207 <span class="preprocessor"></span> <a name="l00208"></a>00208 <span class="preprocessor">#ifdef __cplusplus</span> <a name="l00209"></a>00209 <span class="preprocessor"></span>} <a name="l00210"></a>00210 <span class="preprocessor">#endif</span> <a name="l00211"></a>00211 <span class="preprocessor"></span> <a name="l00212"></a>00212 <span class="preprocessor">#endif </span><span class="comment">/* _TOPOLOGY_H_ */</span> </pre></div></div> </div> <hr class="footer"/><address class="footer"><small>Generated on Tue Feb 8 2011 for libtopology by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address> </body> </html>