root/opal/mca/mpool/base/mpool_base_tree.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2006 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2006 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2007      Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2015      Los Alamos National Security, LLC.  All rights
  15  *                         reserved.
  16  * $COPYRIGHT$
  17  *
  18  * Additional copyrights may follow
  19  *
  20  * $HEADER$
  21  */
  22 
  23 #ifndef MCA_MPOOL_BASE_TREE_H
  24 #define MCA_MPOOL_BASE_TREE_H
  25 
  26 #include "opal_config.h"
  27 
  28 #define MCA_MPOOL_BASE_TREE_MAX 8
  29 #include "opal/mca/mca.h"
  30 #include "opal/mca/mpool/mpool.h"
  31 #include "opal/mca/rcache/rcache.h"
  32 
  33 BEGIN_C_DECLS
  34 
  35 /*
  36  * Data structures for the tree of allocated memory
  37  * used for MPI_Alloc_mem and MPI_Free_mem
  38  */
  39 
  40 /**
  41  * The item in the tree itself
  42  */
  43 struct mca_mpool_base_tree_item_t
  44 {
  45     opal_free_list_item_t super;   /**< the parent class */
  46     void* key; /**< the address this was alloc'd on */
  47     size_t num_bytes; /**< the number of bytes in this alloc, only for
  48                            debugging reporting with
  49                            mpi_show_mpi_alloc_mem_leaks */
  50     mca_mpool_base_module_t *mpool;
  51     mca_rcache_base_module_t *rcaches[MCA_MPOOL_BASE_TREE_MAX]; /**< the registration caches */
  52     mca_rcache_base_registration_t *regs[MCA_MPOOL_BASE_TREE_MAX]; /**< the registrations */
  53     uint8_t count; /**< length of the mpools/regs array */
  54 };
  55 typedef struct mca_mpool_base_tree_item_t mca_mpool_base_tree_item_t;
  56 
  57 OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_mpool_base_tree_item_t);
  58 
  59 /*
  60  * initialize/finalize the rb tree
  61  */
  62 int mca_mpool_base_tree_init(void);
  63 int mca_mpool_base_tree_fini(void);
  64 
  65 /*
  66  * insert an item in the rb tree
  67  */
  68 int mca_mpool_base_tree_insert(mca_mpool_base_tree_item_t* item);
  69 
  70 /*
  71  * remove an item from the rb tree
  72  */
  73 int mca_mpool_base_tree_delete(mca_mpool_base_tree_item_t* item);
  74 
  75 
  76 /**
  77  *  find the item in the rb tree
  78  */
  79 mca_mpool_base_tree_item_t* mca_mpool_base_tree_find(void* base);
  80 
  81 /*
  82  * get a tree item from the free list
  83  */
  84 mca_mpool_base_tree_item_t* mca_mpool_base_tree_item_get(void);
  85 
  86 /*
  87  * put tree item back into the free list
  88  */
  89 void mca_mpool_base_tree_item_put(mca_mpool_base_tree_item_t* item);
  90 
  91 /*
  92  * For debugging, print a show_help kind of message if there are items
  93  * left in the tree. The argument is the number of items to be printed
  94  * before becoming silent.
  95  */
  96 void mca_mpool_base_tree_print(int);
  97 
  98 END_C_DECLS
  99 
 100 #endif /* MCA_MPOOL_BASE_TREE_H */

/* [<][>][^][v][top][bottom][index][help] */