2
* Copyright © 2013 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
19
#include "mir/report/lttng/tracepoint_provider.h"
21
#include <boost/throw_exception.hpp>
29
std::string const tracepoint_lib_install_path{MIR_TRACEPOINT_LIB_INSTALL_PATH};
31
void* open_tracepoint_lib(std::string const& lib_name)
33
auto lib = dlopen(lib_name.c_str(), RTLD_NOW);
37
std::string path{tracepoint_lib_install_path + "/" + lib_name};
38
lib = dlopen(path.c_str(), RTLD_NOW);
43
std::string msg{"Failed to load tracepoint provider: "};
45
BOOST_THROW_EXCEPTION(std::runtime_error(msg));
53
mir::report::lttng::TracepointProvider::TracepointProvider(std::string const& lib_name)
54
: lib{open_tracepoint_lib(lib_name)}
58
mir::report::lttng::TracepointProvider::~TracepointProvider() noexcept