#ifndef MATADOR_METRICS_OBSERVER_HPP #define MATADOR_METRICS_OBSERVER_HPP #include "matador/utils/message_bus.hpp" #include "matador/sql/statement_cache.hpp" namespace matador::test { class MetricsObserver { public: explicit MetricsObserver(utils::message_bus &bus); std::chrono::milliseconds get_average_lock_wait_time() const; std::chrono::milliseconds get_average_execution_time() const; std::chrono::milliseconds get_total_lock_wait_time() const; std::chrono::milliseconds get_total_execution_time() const; size_t get_lock_failure_count() const; private: std::vector subscriptions; mutable std::mutex mutex_; size_t lock_failure_count_{0}; size_t execution_count_{0}; std::chrono::nanoseconds total_lock_wait_time_{0}; std::chrono::nanoseconds total_execution_time_{0}; }; } #endif //MATADOR_METRICS_OBSERVER_HPP