00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00027 #ifndef _TOPOLOGY_H_
00028 #define _TOPOLOGY_H_
00029
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033
00034 #ifndef LIBTOPOLOGY_DOXYGEN_SKIP
00035
00036 #include <sched.h>
00037
00038 #endif
00039
00040 typedef unsigned long topo_context_t;
00041 typedef unsigned long topo_procent_t;
00042 typedef unsigned long topo_device_t;
00043
00044 typedef enum topology_level {
00045 TOPOLOGY_THREAD = 1,
00046 TOPOLOGY_CORE,
00047 TOPOLOGY_PACKAGE,
00048 TOPOLOGY_NODE,
00049 TOPOLOGY_SYSTEM,
00050 } topo_level_t;
00051
00069 extern int topology_init_context(topo_context_t *ctx, topo_procent_t *system);
00070
00084 extern void topology_free_context(topo_context_t ctx);
00085
00106 extern size_t topology_sizeof_cpumask(topo_context_t ctx);
00107
00125 extern topo_procent_t
00126 topology_traverse(topo_procent_t start,
00127 topo_procent_t iter,
00128 topo_level_t to_level);
00141 extern void topology_procent_cpumask(topo_procent_t ent, cpu_set_t *dest);
00142
00159 extern topo_device_t
00160 topology_find_device_by_type(topo_context_t ctx,
00161 topo_device_t prev,
00162 const char *type);
00163
00164
00177 extern void topology_device_cpumask(topo_device_t dev, cpu_set_t *dest);
00178
00191 extern const char *
00192 topology_device_get_attribute(topo_device_t dev, const char *name);
00193
00203 #define topology_for_each_device_of_type(ctx, dev, type) \
00204 for ((dev) = topology_find_device_by_type((ctx), (topo_device_t)0, (type)); \
00205 (dev) != 0; \
00206 (dev) = topology_find_device_by_type((ctx), (dev), (type)))
00207
00208 #ifdef __cplusplus
00209 }
00210 #endif
00211
00212 #endif