root/ompi/mca/mtl/psm2/mtl_psm2_stats.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_mtl_psm2_get_stats
  2. ompi_mtl_psm2_register_pvars

   1 /*
   2  * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2010 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) 2006      QLogic Corporation. All rights reserved.
  13  * Copyright (c) 2006-2017 Los Alamos National Security, LLC.  All rights
  14  *                         reserved.
  15  * Copyright (c) 2013-2015 Intel, Inc. All rights reserved
  16  * $COPYRIGHT$
  17  *
  18  * Additional copyrights may follow
  19  *
  20  * $HEADER$
  21  */
  22 
  23 #include "ompi_config.h"
  24 #include "mtl_psm2.h"
  25 #include "mtl_psm2_types.h"
  26 #include "psm2.h"
  27 #include "ompi/communicator/communicator.h"
  28 #include "ompi/message/message.h"
  29 
  30 #include "opal/mca/base/mca_base_pvar.h"
  31 
  32 struct ompi_mtl_psm2_name_descs
  33 {
  34     char *name;
  35     char *desc;
  36     ptrdiff_t offset;
  37 };
  38 
  39 const struct ompi_mtl_psm2_name_descs name_descs[PSM2_MQ_NUM_STATS] =
  40 {
  41     { "rx_user_bytes", "Bytes received into a matched user buffer", 
  42       offsetof(struct psm2_mq_stats, rx_user_bytes) },
  43     { "rx_user_num", "Messages received into a matched user buffer",
  44       offsetof(struct psm2_mq_stats, rx_user_num) },
  45     { "rx_sys_bytes", "Bytes received into an unmatched system buffer",
  46       offsetof(struct psm2_mq_stats, rx_sys_bytes) },
  47     { "rx_sys_num", "Messages received into an unmatched system buffer",
  48       offsetof(struct psm2_mq_stats, rx_sys_num) },
  49     { "tx_num", "Total Messages transmitted (shm and hfi)",
  50       offsetof(struct psm2_mq_stats, tx_num) },
  51     { "tx_eager_num", "Messages transmitted eagerly",
  52       offsetof(struct psm2_mq_stats, tx_eager_num) },
  53     { "tx_eager_bytes", "Bytes transmitted eagerl",
  54       offsetof(struct psm2_mq_stats, tx_eager_bytes) },
  55     { "tx_rndv_num", "Messages transmitted using expected TID mechanism",
  56       offsetof(struct psm2_mq_stats, tx_rndv_num) },
  57     { "tx_rndv_bytes", "Bytes transmitted using expected TID mechanism",
  58       offsetof(struct psm2_mq_stats, tx_rndv_bytes) },
  59     { "tx_shm_num", "Messages transmitted (shm only)",
  60       offsetof(struct psm2_mq_stats, tx_shm_num) },
  61     { "rx_shm_num", "Messages received through shm",
  62       offsetof(struct psm2_mq_stats, rx_shm_num) },
  63     { "rx_sysbuf_num", "Number of system buffers allocated",
  64       offsetof(struct psm2_mq_stats, rx_sysbuf_num) },
  65     { "rx_sysbuf_bytes", "Bytes allocated for system buffers",
  66       offsetof(struct psm2_mq_stats, rx_sysbuf_bytes) },
  67 };
  68  
  69 static int mca_mtl_psm2_get_stats(const mca_base_pvar_t *pvar, void *value, void *obj)
  70 {
  71     psm2_mq_stats_t stats;
  72     int index = (int)(intptr_t) pvar->ctx;
  73 
  74     psm2_mq_get_stats(ompi_mtl_psm2.mq, &stats);
  75 
  76     *(uint64_t *)value = *(uint64_t *)((uint8_t *)&stats + name_descs[index].offset); 
  77 
  78     return OMPI_SUCCESS;
  79 }
  80 
  81 
  82 int ompi_mtl_psm2_register_pvars(void)
  83 {
  84     int i;
  85 
  86     /* PSM2 MQ performance variables */
  87     for (i = 0 ; i < PSM2_MQ_NUM_STATS; ++i) {
  88         (void) mca_base_component_pvar_register (&mca_mtl_psm2_component.super.mtl_version, 
  89                                                  name_descs[i].name, name_descs[i].desc,
  90                                                  OPAL_INFO_LVL_4, MCA_BASE_PVAR_CLASS_COUNTER,
  91                                                  MCA_BASE_VAR_TYPE_UNSIGNED_LONG,
  92                                                  NULL, MCA_BASE_VAR_BIND_NO_OBJECT,
  93                                                  MCA_BASE_PVAR_FLAG_READONLY | MCA_BASE_PVAR_FLAG_CONTINUOUS,
  94                                                  mca_mtl_psm2_get_stats, NULL, NULL,
  95                                                  (void *) (intptr_t) i);
  96     }
  97     return OMPI_SUCCESS;
  98 }

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