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) 2013 Cisco Systems, Inc. All rights reserved.
8 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
9 * reserved.
10 * $COPYRIGHT$
11 *
12 * Additional copyrights may follow
13 *
14 * $HEADER$
15 */
16
17 /**
18 * These symbols are in a file by themselves to provide nice linker
19 * semantics. Since linkers generally pull in symbols by object
20 * files, keeping these symbols as the only symbols in this file
21 * prevents utility programs such as "ompi_info" from having to import
22 * entire components just to query their version and parameters.
23 */
24
25 #include "opal_config.h"
26
27 #include "opal/constants.h"
28 #include "opal/mca/memchecker/memchecker.h"
29 #include "memchecker_valgrind.h"
30
31 int opal_memchecker_component_priority = 0;
32
33 /*
34 * Public string showing the memchecker ompi_linux component version number
35 */
36 const char *opal_memchecker_valgrind_component_version_string =
37 "OPAL valgrind memchecker MCA component version " OPAL_VERSION;
38
39 /*
40 * Local function
41 */
42 static int valgrind_register(void);
43 static int valgrind_open(void);
44 static int valgrind_close(void);
45
46 /*
47 * Instantiate the public struct with all of our public information
48 * and pointers to our public functions in it
49 */
50
51 const opal_memchecker_base_component_2_0_0_t mca_memchecker_valgrind_component = {
52
53 /* First, the mca_component_t struct containing meta information
54 about the component itself */
55 .base_version = {
56 OPAL_MEMCHECKER_BASE_VERSION_2_0_0,
57
58 /* Component name and version */
59 .mca_component_name = "valgrind",
60 MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
61 OPAL_RELEASE_VERSION),
62
63 /* Component open and close functions */
64 .mca_open_component = valgrind_open,
65 .mca_close_component = valgrind_close,
66 .mca_query_component = opal_memchecker_valgrind_component_query,
67 .mca_register_component_params = valgrind_register
68 },
69 .base_data = {
70 /* Valgrind does not offer functionality to save the state */
71 MCA_BASE_METADATA_PARAM_CHECKPOINT
72 }
73 };
74
75
76 static int valgrind_register(void)
77 {
78 opal_memchecker_component_priority = 0;
79 (void) mca_base_component_var_register(&mca_memchecker_valgrind_component.base_version,
80 "priority", "Priority for the memchecker valgrind "
81 "component (default: 0)", MCA_BASE_VAR_TYPE_INT,
82 NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
83 OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_ALL_EQ,
84 &opal_memchecker_component_priority);
85
86 return OPAL_SUCCESS;
87 }
88
89 static int valgrind_open(void)
90 {
91 /*
92 * Any initialization of valgrind upon starting of the component
93 * should be done here.
94 *
95 * Possibilities are, that we need to set special stuff, when
96 * valgrind is not being run / actually is being run.
97 */
98 return OPAL_SUCCESS;
99 }
100
101
102 static int valgrind_close(void)
103 {
104 /*
105 * Any closing of valgrind upon starting of the component
106 * should be done here.
107 *
108 * Possibilities are, that we need to set special stuff, when
109 * valgrind is not being run / actually is being run.
110 */
111 return OPAL_SUCCESS;
112 }
113