topology.h File Reference

The libtopology API. More...

#include <sys/types.h>
#include <stdio.h>
#include <topology/cpuset.h>
#include <topology/helper.h>

Go to the source code of this file.

Data Structures

struct  topo_topology_info
 Global information about a Topology context,. More...
struct  topo_obj
 Structure of a topology Object. More...
union  topo_obj_attr_u
 Object type-specific Attributes. More...
struct  topo_obj_attr_u::topo_cache_attr_u
 Cache-specific Object Attributes. More...
struct  topo_obj_attr_u::topo_memory_attr_u
 Node-specific Object Attributes. More...
struct  topo_obj_attr_u::topo_machine_attr_u
struct  topo_obj_attr_u::topo_misc_attr_u
 Misc-specific Object Attributes. More...

Defines

#define TOPO_OBJ_TYPE_MAX   (TOPO_OBJ_MISC+1)
 Maximal value of an Object Type.
#define TOPO_TYPE_DEPTH_UNKNOWN   -1
 No object of given type exists in the topology.
#define TOPO_TYPE_DEPTH_MULTIPLE   -2
 Objects of given type exist at different depth in the topology.

Typedefs

typedef struct topo_topology * topo_topology_t
 Topology context.
typedef struct topo_objtopo_obj_t

Enumerations

enum  topo_obj_type_t {
  TOPO_OBJ_SYSTEM, TOPO_OBJ_MACHINE, TOPO_OBJ_NODE, TOPO_OBJ_SOCKET,
  TOPO_OBJ_CACHE, TOPO_OBJ_CORE, TOPO_OBJ_PROC, TOPO_OBJ_MISC
}
 Type of topology Object. More...
enum  topo_flags_e { TOPO_FLAGS_WHOLE_SYSTEM = (1<<1) }
 Flags to be set onto a topology context before load. More...
enum  topo_cpubind_policy_t { TOPO_CPUBIND_PROCESS = (1<<0), TOPO_CPUBIND_THREAD = (1<<1), TOPO_CPUBIND_STRICT = (1<<2) }
 Process/Thread binding policy. More...

Functions

int topo_get_type_order (topo_obj_type_t type)
 Convert an object type into a number that permits to compare them.
topo_obj_type_t topo_get_order_type (int order)
 Converse of topo_get_type_oder().
int topo_topology_init (topo_topology_t *topologyp)
 Allocate a topology context.
int topo_topology_load (topo_topology_t topology)
 Build the actual topology.
void topo_topology_destroy (topo_topology_t topology)
 Terminate and free a topology context.
void topo_topology_check (topo_topology_t topology)
 Run internal checks on a topology structure.
int topo_topology_ignore_type (topo_topology_t topology, topo_obj_type_t type)
 Ignore an object type.
int topo_topology_ignore_type_keep_structure (topo_topology_t topology, topo_obj_type_t type)
 Ignore an object type if it does not bring any structure.
int topo_topology_ignore_all_keep_structure (topo_topology_t topology)
 Ignore all objects that do not bring any structure.
int topo_topology_set_flags (topo_topology_t topology, unsigned long flags)
 Set OR'ed flags to non-yet-loaded topology.
int topo_topology_set_fsys_root (topo_topology_t __topo_restrict topology, const char *__topo_restrict fsys_root_path)
 Change the file-system root path when building the topology from sysfs/procfs.
int topo_topology_set_synthetic (topo_topology_t __topo_restrict topology, const char *__topo_restrict description)
 Enable synthetic topology.
int topo_topology_set_xml (topo_topology_t __topo_restrict topology, const char *__topo_restrict xmlpath)
 Enable XML-file based topology.
int topo_topology_get_info (topo_topology_t __topo_restrict topology, struct topo_topology_info *__topo_restrict info)
 Get additional global information about the topology.
unsigned topo_get_type_depth (topo_topology_t topology, topo_obj_type_t type)
 Returns the depth of objects of type type.
topo_obj_type_t topo_get_depth_type (topo_topology_t topology, unsigned depth)
 Returns the type of objects at depth depth.
unsigned topo_get_depth_nbobjs (topo_topology_t topology, unsigned depth)
 Returns the width of level at depth depth.
topo_obj_t topo_get_obj_by_depth (topo_topology_t topology, unsigned depth, unsigned index)
 Returns the topology object at index index from depth depth.
const char * topo_obj_type_string (topo_obj_type_t type)
 Return a stringified topology object type.
topo_obj_type_t topo_obj_type_of_string (const char *string)
 Return an object type from the string.
int topo_obj_snprintf (char *__topo_restrict string, size_t size, topo_topology_t topology, topo_obj_t obj, const char *__topo_restrict indexprefix, int verbose)
 Stringify a given topology object into a human-readable form.
int topo_obj_cpuset_snprintf (char *__topo_restrict str, size_t size, size_t nobj, const topo_obj_t *__topo_restrict objs)
 Stringify the cpuset containing a set of objects.
int topo_set_cpubind (topo_topology_t topology, const topo_cpuset_t *set, int policy)
 Bind current process or thread on cpus given in cpuset set.
int topo_set_proc_cpubind (topo_topology_t topology, topo_pid_t pid, const topo_cpuset_t *set, int policy)
 Bind a process pid on cpus given in cpuset set.
int topo_set_thread_cpubind (topo_topology_t topology, topo_thread_t tid, const topo_cpuset_t *set, int policy)
 Bind a thread tid on cpus given in cpuset set.


Detailed Description

The libtopology API.

See topology/cpuset.h for CPU set specific macros See topology/helper.h for high-level topology traversal helpers


Generated on Fri Jul 3 19:00:23 2009 for libtopology by  doxygen 1.5.9