}
};
+ProfLoggerConfObs::~ProfLoggerConfObs()
+{
+}
+
+const char **ProfLoggerConfObs::get_tracked_conf_keys() const
+{
+ static const char *KEYS[] = {
+ "profiling_logger", "profiling_logger_interval", "profiling_logger_calc_variance",
+ "profiling_logger_subdir", "profiling_logger_dir"
+ };
+ return KEYS;
+}
+
+void ProfLoggerConfObs::handle_conf_change(const md_config_t *conf,
+ const std::set <std::string> &changed)
+{
+ // This could be done a *lot* smarter, if anyone cares to spend time
+ // fixing this up.
+ // We could probably just take the mutex and call _open_log from here.
+ logger_reopen_all();
+}
void logger_reopen_all()
{
#ifndef CEPH_LOGGER_H
#define CEPH_LOGGER_H
+#include "common/config.h"
#include "common/Clock.h"
#include "common/ProfLogType.h"
#include "include/types.h"
extern void logger_tare(utime_t when);
extern void logger_start();
+class ProfLoggerConfObs : public md_config_obs_t {
+public:
+ ~ProfLoggerConfObs();
+ virtual const char** get_tracked_conf_keys() const;
+ virtual void handle_conf_change(const md_config_t *conf,
+ const std::set <std::string> &changed);
+};
+
class ProfLogger {
protected:
// my type
md_config_t::
md_config_t()
: _doss(new DoutStreambuf <char, std::basic_string<char>::traits_type>()),
- _dout(_doss)
+ _dout(_doss),
+ _prof_logger_conf_obs(new ProfLoggerConfObs())
{
//
// Note: because our md_config_t structure is a global, the memory used to
}
add_observer(_doss);
+ add_observer(_prof_logger_conf_obs);
}
md_config_t::
~md_config_t()
{
+ free(_doss);
+ _doss = NULL;
+ free(_prof_logger_conf_obs);
+ _prof_logger_conf_obs = NULL;
}
void md_config_t::
DoutStreambuf <char, std::basic_string<char>::traits_type> *_doss;
std::ostream _dout;
+ md_config_obs_t *_prof_logger_conf_obs;
};
extern md_config_t g_conf;