Skip to content

Commit e515c63

Browse files
committed
Helper functions for suppressing events by syscall name
1 parent 7b209ae commit e515c63

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

userspace/libsinsp/utils.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,30 @@ void sinsp_utils::split_container_image(const std::string &image,
881881
}
882882
}
883883

884+
void sinsp_utils::parse_suppressed_types(const std::vector<std::string> &supp_strs,
885+
std::vector<uint16_t> *supp_ids)
886+
{
887+
for (auto ii = 0; ii < PPM_EVENT_MAX; ii++)
888+
{
889+
auto iter = std::find(supp_strs.begin(), supp_strs.end(),
890+
event_name_by_id(ii));
891+
if (iter != supp_strs.end())
892+
{
893+
supp_ids->push_back(ii);
894+
}
895+
}
896+
}
897+
898+
const char* sinsp_utils::event_name_by_id(uint16_t id)
899+
{
900+
if (id >= PPM_EVENT_MAX)
901+
{
902+
ASSERT(false);
903+
return "NA";
904+
}
905+
return g_infotables.m_event_info[id].name;
906+
}
907+
884908
///////////////////////////////////////////////////////////////////////////////
885909
// Time utility functions.
886910
///////////////////////////////////////////////////////////////////////////////

userspace/libsinsp/utils.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ class sinsp_utils
117117
std::string &tag,
118118
std::string &digest,
119119
bool split_repo = true);
120+
121+
static void parse_suppressed_types(const std::vector<std::string> &supp_strs,
122+
std::vector<uint16_t> *supp_ids);
123+
124+
static const char* event_name_by_id(uint16_t id);
120125
};
121126

122127
///////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)