Skip to content

Commit 5a5edfc

Browse files
authored
Merge pull request #3876 from hppritcha/topic/add_psm2_get_stats
mtl/psm2: add pvar support for PSM2 MQ stats
2 parents 2060fcf + 701a1d0 commit 5a5edfc

File tree

4 files changed

+107
-3
lines changed

4 files changed

+107
-3
lines changed

ompi/mca/mtl/psm2/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# All rights reserved.
1212
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
1313
# Copyright (c) 2015 Intel, Inc. All rights reserved
14+
# Copyright (c) 2017 Los Alamos National Security, LLC.
15+
# All rights reserved.
16+
#
1417
# $COPYRIGHT$
1518
#
1619
# Additional copyrights may follow
@@ -35,6 +38,7 @@ mtl_psm2_sources = \
3538
mtl_psm2_recv.c \
3639
mtl_psm2_request.h \
3740
mtl_psm2_send.c \
41+
mtl_psm2_stats.c \
3842
mtl_psm2_types.h
3943

4044
# Make the output library in this directory, and name it either

ompi/mca/mtl/psm2/mtl_psm2.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* All rights reserved.
1313
* Copyright (c) 2006 QLogic Corporation. All rights reserved.
1414
* Copyright (c) 2015 Intel, Inc. All rights reserved
15-
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
15+
* Copyright (c) 2015-2017 Los Alamos National Security, LLC. All rights
1616
* reserved.
1717
* $COPYRIGHT$
1818
*
@@ -103,6 +103,7 @@ extern int ompi_mtl_psm2_finalize(struct mca_mtl_base_module_t* mtl);
103103

104104
int ompi_mtl_psm2_module_init(int local_rank, int num_local_procs);
105105

106+
extern int ompi_mtl_psm2_register_pvars(void);
106107

107108

108109
END_C_DECLS

ompi/mca/mtl/psm2/mtl_psm2_component.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static void ompi_mtl_psm2_set_shadow_env (struct ompi_mtl_psm2_shadow_variable *
115115
{
116116
mca_base_var_storage_t *storage = variable->storage;
117117
char *env_value;
118-
int ret;
118+
int ret = 0;
119119

120120
switch (variable->variable_type) {
121121
case MCA_BASE_VAR_TYPE_BOOL:
@@ -230,11 +230,12 @@ ompi_mtl_psm2_component_register(void)
230230
MCA_BASE_VAR_SCOPE_READONLY,
231231
&param_priority);
232232

233-
234233
for (int i = 0 ; ompi_mtl_psm2_shadow_variables[i].variable_type >= 0 ; ++i) {
235234
ompi_mtl_psm2_register_shadow_env (ompi_mtl_psm2_shadow_variables + i);
236235
}
237236

237+
ompi_mtl_psm2_register_pvars();
238+
238239
return OMPI_SUCCESS;
239240
}
240241

ompi/mca/mtl/psm2/mtl_psm2_stats.c

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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+
}

0 commit comments

Comments
 (0)