cleanup(userspace): remove unused logic

Signed-off-by: Andrea Terzolo <andrea.terzolo@polito.it>
This commit is contained in:
Andrea Terzolo
2022-07-13 16:51:49 +02:00
committed by poiana
parent 4136a27de1
commit 35db0b4a24
2 changed files with 0 additions and 31 deletions

View File

@@ -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<sinsp> 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;

View File

@@ -43,6 +43,5 @@ protected:
uint32_t m_num_stats;
std::shared_ptr<sinsp> m_inspector;
std::ofstream m_output;
std::string m_extra;
scap_stats m_last_stats;
};