From 35db0b4a24344bc6c24022555f7d8531ad925136 Mon Sep 17 00:00:00 2001 From: Andrea Terzolo Date: Wed, 13 Jul 2022 16:51:49 +0200 Subject: [PATCH] cleanup(userspace): remove unused logic Signed-off-by: Andrea Terzolo --- userspace/falco/statsfilewriter.cpp | 30 ----------------------------- userspace/falco/statsfilewriter.h | 1 - 2 files changed, 31 deletions(-) diff --git a/userspace/falco/statsfilewriter.cpp b/userspace/falco/statsfilewriter.cpp index d1e0b102..bf4d20ef 100644 --- a/userspace/falco/statsfilewriter.cpp +++ b/userspace/falco/statsfilewriter.cpp @@ -30,8 +30,6 @@ static void timer_handler (int signum) g_save_stats = true; } -extern char **environ; - StatsFileWriter::StatsFileWriter() : m_num_stats(0) { @@ -69,30 +67,6 @@ bool StatsFileWriter::init(std::shared_ptr inspector, string &filename, u return false; } - // (Undocumented) feature. Take any environment keys prefixed - // with FALCO_STATS_EXTRA_XXX and add them to the output. Used by - // run_performance_tests.sh. - for(uint32_t i=0; environ[i]; i++) - { - char *p = strstr(environ[i], "="); - if(!p) - { - errstr = string("Could not find environment separator in ") + string(environ[i]); - return false; - } - string key(environ[i], p-environ[i]); - string val(p+1, strlen(environ[i])-(p-environ[i])-1); - if(key.compare(0, 18, "FALCO_STATS_EXTRA_") == 0) - { - string sub = key.substr(18); - if (m_extra != "") - { - m_extra += ", "; - } - m_extra += "\"" + sub + "\": " + "\"" + val + "\""; - } - } - return true; } @@ -122,10 +96,6 @@ void StatsFileWriter::handle() try { jmsg["sample"] = m_num_stats; - if(m_extra != "") - { - jmsg["extra"] = m_extra; - } jmsg["cur"]["events"] = cstats.n_evts; jmsg["cur"]["drops"] = cstats.n_drops; jmsg["cur"]["preemptions"] = cstats.n_preemptions; diff --git a/userspace/falco/statsfilewriter.h b/userspace/falco/statsfilewriter.h index aa783c73..394513bf 100644 --- a/userspace/falco/statsfilewriter.h +++ b/userspace/falco/statsfilewriter.h @@ -43,6 +43,5 @@ protected: uint32_t m_num_stats; std::shared_ptr m_inspector; std::ofstream m_output; - std::string m_extra; scap_stats m_last_stats; };