diff --git a/userspace/libsinsp/sinsp.h b/userspace/libsinsp/sinsp.h index 087a0b6324..0b09831609 100644 --- a/userspace/libsinsp/sinsp.h +++ b/userspace/libsinsp/sinsp.h @@ -989,6 +989,9 @@ class SINSP_PUBLIC sinsp : public capture_stats_source const std::string& get_host_root() const { return m_host_root; } void set_host_root(const std::string& s) { m_host_root = s; } + const int32_t& get_quantization_interval() const { return m_quantization_interval; } + void set_quantization_interval(const int32_t& v) { m_quantization_interval = v; } + void set_observer(sinsp_observer* observer) { m_observer = observer; } sinsp_observer* get_observer() const { return m_observer; } @@ -1113,6 +1116,8 @@ VISIBILITY_PRIVATE std::string m_host_root; + int32_t m_quantization_interval = -1; + public: sinsp_thread_manager* m_thread_manager; diff --git a/userspace/libsinsp/sinsp_filtercheck_event.cpp b/userspace/libsinsp/sinsp_filtercheck_event.cpp index b2e8235bee..4013e4b5ac 100644 --- a/userspace/libsinsp/sinsp_filtercheck_event.cpp +++ b/userspace/libsinsp/sinsp_filtercheck_event.cpp @@ -30,7 +30,6 @@ limitations under the License. using namespace std; extern sinsp_evttables g_infotables; -static int32_t g_screen_w = -1; #define RETURN_EXTRACT_VAR(x) do { \ *len = sizeof((x)); \ @@ -784,7 +783,7 @@ uint8_t* sinsp_filter_check_event::extract(sinsp_evt *evt, OUT uint32_t* len, bo llatency = 11; } - m_u64val = (uint64_t)(llatency * g_screen_w / 11) + 1; + m_u64val = (uint64_t)(llatency * m_inspector->get_quantization_interval() / 11) + 1; RETURN_EXTRACT_VAR(m_u64val); } diff --git a/userspace/libsinsp/sinsp_filtercheck_tracer.cpp b/userspace/libsinsp/sinsp_filtercheck_tracer.cpp index eae0a5b7fa..3870e61ff2 100644 --- a/userspace/libsinsp/sinsp_filtercheck_tracer.cpp +++ b/userspace/libsinsp/sinsp_filtercheck_tracer.cpp @@ -27,8 +27,6 @@ limitations under the License. using namespace std; -static int32_t g_screen_w = -1; - #define RETURN_EXTRACT_VAR(x) do { \ *len = sizeof((x)); \ return (uint8_t*) &(x); \ @@ -590,7 +588,7 @@ uint8_t* sinsp_filter_check_tracer::extract(sinsp_evt *evt, OUT uint32_t* len, b lduration = 11; } - m_s64val = (uint64_t)(lduration * g_screen_w / 11) + 1; + m_s64val = (uint64_t)(lduration * m_inspector->get_quantization_interval() / 11) + 1; RETURN_EXTRACT_VAR(m_s64val); }