This source file includes following definitions.
- mca_mtl_psm2_get_stats
- ompi_mtl_psm2_register_pvars
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
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 }