]>
git.proxmox.com Git - ceph.git/blob - ceph/src/common/TracepointProvider.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "common/TracepointProvider.h"
5 #include "common/config.h"
7 TracepointProvider::TracepointProvider(CephContext
*cct
, const char *library
,
8 const char *config_key
)
9 : m_cct(cct
), m_library(library
), m_config_keys
{config_key
, NULL
},
10 m_lock("TracepointProvider::m_lock") {
11 m_cct
->_conf
->add_observer(this);
12 verify_config(m_cct
->_conf
);
15 TracepointProvider::~TracepointProvider() {
16 m_cct
->_conf
->remove_observer(this);
22 void TracepointProvider::handle_conf_change(
23 const struct md_config_t
*conf
, const std::set
<std::string
> &changed
) {
24 if (changed
.count(m_config_keys
[0])) {
29 void TracepointProvider::verify_config(const struct md_config_t
*conf
) {
30 Mutex::Locker
locker(m_lock
);
37 if (conf
->get_val(m_config_keys
[0], &pbuf
, sizeof(buf
)) != 0 ||
38 strncmp(buf
, "true", 5) != 0) {
42 m_handle
= dlopen(m_library
.c_str(), RTLD_NOW
| RTLD_NODELETE
);