1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3  * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
4  *                         University of Stuttgart.  All rights reserved.
5  * Copyright (c) 2004-2008 The Trustees of Indiana University.
6  *                         All rights reserved.
7  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
8  *                         reserved.
9  *
10  * $COPYRIGHT$
11  *
12  * Additional copyrights may follow
13  *
14  * $HEADER$
15  */
16 
17 /**
18  * @file
19  *
20  * pstat (process statistics) framework component interface.
21  *
22  * Intent
23  *
24  * To support the ompi-top utility.
25  *
26  */
27 
28 #ifndef OPAL_MCA_PSTAT_H
29 #define OPAL_MCA_PSTAT_H
30 
31 #include "opal_config.h"
32 
33 #include "opal/mca/mca.h"
34 #include "opal/mca/base/base.h"
35 #include "opal/dss/dss_types.h"
36 
37 BEGIN_C_DECLS
38 
39 /**
40  * Module initialization function.  Should return OPAL_SUCCESS.
41  */
42 typedef int (*opal_pstat_base_module_init_fn_t)(void);
43 
44 typedef int (*opal_pstat_base_module_query_fn_t)(pid_t pid,
45                                                  opal_pstats_t *stats,
46                                                  opal_node_stats_t *nstats);
47 
48 typedef int (*opal_pstat_base_module_fini_fn_t)(void);
49 
50 /**
51  * Structure for pstat components.
52  */
53 struct opal_pstat_base_component_2_0_0_t {
54     /** MCA base component */
55     mca_base_component_t base_version;
56     /** MCA base data */
57     mca_base_component_data_t base_data;
58 };
59 
60 /**
61  * Convenience typedef
62  */
63 typedef struct opal_pstat_base_component_2_0_0_t opal_pstat_base_component_2_0_0_t;
64 typedef struct opal_pstat_base_component_2_0_0_t opal_pstat_base_component_t;
65 
66 /**
67  * Structure for pstat modules
68  */
69 struct opal_pstat_base_module_1_0_0_t {
70     opal_pstat_base_module_init_fn_t    init;
71     opal_pstat_base_module_query_fn_t   query;
72     opal_pstat_base_module_fini_fn_t    finalize;
73 };
74 
75 /**
76  * Convenience typedef
77  */
78 typedef struct opal_pstat_base_module_1_0_0_t opal_pstat_base_module_1_0_0_t;
79 typedef struct opal_pstat_base_module_1_0_0_t opal_pstat_base_module_t;
80 
81 
82 /**
83  * Macro for use in components that are of type pstat
84  */
85 #define OPAL_PSTAT_BASE_VERSION_2_0_0 \
86     OPAL_MCA_BASE_VERSION_2_1_0("pstat", 2, 0, 0)
87 
88 /* Global structure for accessing pstat functions */
89 OPAL_DECLSPEC extern opal_pstat_base_module_t opal_pstat;
90 
91 END_C_DECLS
92 
93 #endif /* OPAL_MCA_PSTAT_H */
94