OpenMPI  0.1.1
mpool_base_tree.h
1 /*
2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3  * University Research and Technology
4  * Corporation. All rights reserved.
5  * Copyright (c) 2004-2006 The University of Tennessee and The University
6  * of Tennessee Research Foundation. All rights
7  * reserved.
8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9  * University of Stuttgart. All rights reserved.
10  * Copyright (c) 2004-2006 The Regents of the University of California.
11  * All rights reserved.
12  * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
13  * $COPYRIGHT$
14  *
15  * Additional copyrights may follow
16  *
17  * $HEADER$
18  */
19 
20 #ifndef MCA_MPOOL_BASE_TREE_H
21 #define MCA_MPOOL_BASE_TREE_H
22 
23 #include "ompi_config.h"
24 
25 #define MCA_MPOOL_BASE_TREE_MAX 8
26 #include "opal/mca/mca.h"
27 #include "ompi/class/ompi_free_list.h"
28 #include "ompi/mca/mpool/mpool.h"
29 
30 BEGIN_C_DECLS
31 
32 /*
33  * Data structures for the tree of allocated memory
34  * used for MPI_Alloc_mem and MPI_Free_mem
35  */
36 
37 /**
38  * The item in the tree itself
39  */
41 {
42  ompi_free_list_item_t super; /**< the parent class */
43  void* key; /**< the address this was alloc'd on */
44  size_t num_bytes; /**< the number of bytes in this alloc, only for
45  debugging reporting with
46  mpi_show_mpi_alloc_mem_leaks */
47  mca_mpool_base_module_t* mpools[MCA_MPOOL_BASE_TREE_MAX]; /**< the mpools */
48  mca_mpool_base_registration_t* regs[MCA_MPOOL_BASE_TREE_MAX]; /**< the registrations */
49  uint8_t count; /**< length of the mpools/regs array */
50 };
52 
54 
55 /*
56  * initialize the rb tree
57  */
58 int mca_mpool_base_tree_init(void);
59 
60 /*
61  * insert an item in the rb tree
62  */
63 int mca_mpool_base_tree_insert(mca_mpool_base_tree_item_t* item);
64 
65 /*
66  * remove an item from the rb tree
67  */
68 int mca_mpool_base_tree_delete(mca_mpool_base_tree_item_t* item);
69 
70 
71 /**
72  * find the item in the rb tree
73  */
75 
76 /*
77  * get a tree item from the free list
78  */
79 mca_mpool_base_tree_item_t* mca_mpool_base_tree_item_get(void);
80 
81 /*
82  * put tree item back into the free list
83  */
84 void mca_mpool_base_tree_item_put(mca_mpool_base_tree_item_t* item);
85 
86 /*
87  * For debugging, print a show_help kind of message if there are items
88  * left in the tree.
89  */
90 void mca_mpool_base_tree_print(void);
91 
92 END_C_DECLS
93 
94 #endif /* MCA_MPOOL_BASE_TREE_H */
ompi_free_list_item_t super
the parent class
Definition: mpool_base_tree.h:42
uint8_t count
length of the mpools/regs array
Definition: mpool_base_tree.h:49
size_t num_bytes
the number of bytes in this alloc, only for debugging reporting with mpi_show_mpi_alloc_mem_leaks ...
Definition: mpool_base_tree.h:44
mca_mpool_base_registration_t * regs[MCA_MPOOL_BASE_TREE_MAX]
the registrations
Definition: mpool_base_tree.h:48
Definition: mpool.h:44
void * key
the address this was alloc'd on
Definition: mpool_base_tree.h:43
Top-level interface for all MCA components.
The item in the tree itself.
Definition: mpool_base_tree.h:40
Definition: ompi_free_list.h:62
Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana University Research and Techno...
mca_mpool_base_module_t * mpools[MCA_MPOOL_BASE_TREE_MAX]
the mpools
Definition: mpool_base_tree.h:47
mca_mpool_base_tree_item_t * mca_mpool_base_tree_find(void *base)
find the item in the rb tree
Definition: mpool_base_tree.c:129
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236
mpool module descriptor.
Definition: mpool.h:174