mirror of
https://github.com/OISF/suricata.git
synced 2026-10-12 02:07:10 +00:00
threads: remove thread group name logic
Once used to merge stats. Stats are tracked per thread and merge by counter name in the current code. It was set only for autofp modes.
This commit is contained in:
@@ -22,7 +22,6 @@ Functions
|
||||
|
||||
- ``id`` (number): Thread ID
|
||||
- ``name`` (string): Thread name
|
||||
- ``group_name`` (string): Thread group name
|
||||
|
||||
Example::
|
||||
|
||||
@@ -31,4 +30,3 @@ Functions
|
||||
local info = util.thread_info()
|
||||
print("Thread ID: " .. info.id)
|
||||
print("Thread Name: " .. info.name)
|
||||
print("Thread Group: " .. info.group_name)
|
||||
|
||||
+6
-9
@@ -1002,9 +1002,8 @@ void StatsSpawnThreads(void)
|
||||
*/
|
||||
StatsCounterId StatsRegisterCounter(const char *name, struct ThreadVars_ *tv)
|
||||
{
|
||||
uint16_t id = StatsRegisterQualifiedCounter(name,
|
||||
(tv->thread_group_name != NULL) ? tv->thread_group_name : tv->printable_name,
|
||||
&tv->stats.pub, STATS_TYPE_NORMAL, NULL);
|
||||
uint16_t id = StatsRegisterQualifiedCounter(
|
||||
name, tv->printable_name, &tv->stats.pub, STATS_TYPE_NORMAL, NULL);
|
||||
StatsCounterId s = { .id = id };
|
||||
return s;
|
||||
}
|
||||
@@ -1022,9 +1021,8 @@ StatsCounterId StatsRegisterCounter(const char *name, struct ThreadVars_ *tv)
|
||||
*/
|
||||
StatsCounterAvgId StatsRegisterAvgCounter(const char *name, struct ThreadVars_ *tv)
|
||||
{
|
||||
uint16_t id = StatsRegisterQualifiedCounter(name,
|
||||
(tv->thread_group_name != NULL) ? tv->thread_group_name : tv->printable_name,
|
||||
&tv->stats.pub, STATS_TYPE_AVERAGE, NULL);
|
||||
uint16_t id = StatsRegisterQualifiedCounter(
|
||||
name, tv->printable_name, &tv->stats.pub, STATS_TYPE_AVERAGE, NULL);
|
||||
StatsCounterAvgId s = { .id = id };
|
||||
return s;
|
||||
}
|
||||
@@ -1042,9 +1040,8 @@ StatsCounterAvgId StatsRegisterAvgCounter(const char *name, struct ThreadVars_ *
|
||||
*/
|
||||
StatsCounterMaxId StatsRegisterMaxCounter(const char *name, struct ThreadVars_ *tv)
|
||||
{
|
||||
uint16_t id = StatsRegisterQualifiedCounter(name,
|
||||
(tv->thread_group_name != NULL) ? tv->thread_group_name : tv->printable_name,
|
||||
&tv->stats.pub, STATS_TYPE_MAXIMUM, NULL);
|
||||
uint16_t id = StatsRegisterQualifiedCounter(
|
||||
name, tv->printable_name, &tv->stats.pub, STATS_TYPE_MAXIMUM, NULL);
|
||||
StatsCounterMaxId s = { .id = id };
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -212,8 +212,6 @@ int RunModeErfFileAutoFp(void)
|
||||
}
|
||||
}
|
||||
|
||||
TmThreadSetGroupName(tv_detect_ncpu, "Detect");
|
||||
|
||||
if (TmThreadSpawn(tv_detect_ncpu) != TM_ECODE_OK) {
|
||||
printf("ERROR: TmThreadSpawn failed\n");
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
@@ -209,8 +209,6 @@ int RunModeFilePcapAutoFp(void)
|
||||
}
|
||||
TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
|
||||
|
||||
TmThreadSetGroupName(tv_detect_ncpu, "Detect");
|
||||
|
||||
TmThreadSetCPU(tv_detect_ncpu, WORKER_CPU_SET);
|
||||
|
||||
if (TmThreadSpawn(tv_detect_ncpu) != TM_ECODE_OK) {
|
||||
|
||||
@@ -65,7 +65,6 @@ typedef struct ThreadVars_ {
|
||||
|
||||
char name[16];
|
||||
char *printable_name;
|
||||
char *thread_group_name;
|
||||
|
||||
uint8_t thread_setup_flags;
|
||||
|
||||
|
||||
@@ -1649,10 +1649,6 @@ static void TmThreadFree(ThreadVars *tv)
|
||||
|
||||
TmThreadDeinitMC(tv);
|
||||
|
||||
if (tv->thread_group_name) {
|
||||
SCFree(tv->thread_group_name);
|
||||
}
|
||||
|
||||
if (tv->printable_name) {
|
||||
SCFree(tv->printable_name);
|
||||
}
|
||||
@@ -1678,24 +1674,6 @@ static void TmThreadFree(ThreadVars *tv)
|
||||
SCFree(tv);
|
||||
}
|
||||
|
||||
void TmThreadSetGroupName(ThreadVars *tv, const char *name)
|
||||
{
|
||||
char *thread_group_name = NULL;
|
||||
|
||||
if (name == NULL)
|
||||
return;
|
||||
|
||||
if (tv == NULL)
|
||||
return;
|
||||
|
||||
thread_group_name = SCStrdup(name);
|
||||
if (unlikely(thread_group_name == NULL)) {
|
||||
SCLogError("error allocating memory");
|
||||
return;
|
||||
}
|
||||
tv->thread_group_name = thread_group_name;
|
||||
}
|
||||
|
||||
void TmThreadClearThreadsFamily(int family)
|
||||
{
|
||||
ThreadVars *tv = NULL;
|
||||
|
||||
@@ -100,7 +100,6 @@ void TmThreadKillThreadsFamily(int family);
|
||||
void TmThreadKillThreads(void);
|
||||
void TmThreadClearThreadsFamily(int family);
|
||||
void TmThreadAppend(ThreadVars *, int);
|
||||
void TmThreadSetGroupName(ThreadVars *tv, const char *name);
|
||||
|
||||
TmEcode TmThreadSetCPUAffinity(ThreadVars *, uint16_t);
|
||||
TmEcode TmThreadSetThreadPriority(ThreadVars *, int);
|
||||
|
||||
@@ -48,10 +48,6 @@ static int LuaUtilThreadInfo(lua_State *luastate)
|
||||
lua_pushstring(luastate, tv->name);
|
||||
lua_settable(luastate, -3);
|
||||
|
||||
lua_pushstring(luastate, "group_name");
|
||||
lua_pushstring(luastate, tv->thread_group_name);
|
||||
lua_settable(luastate, -3);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,8 +226,6 @@ int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser,
|
||||
|
||||
TmThreadSetCPU(tv_detect_ncpu, WORKER_CPU_SET);
|
||||
|
||||
TmThreadSetGroupName(tv_detect_ncpu, "Detect");
|
||||
|
||||
tm_module = TmModuleGetByName("RespondReject");
|
||||
if (tm_module == NULL) {
|
||||
FatalError("TmModuleGetByName RespondReject failed");
|
||||
@@ -459,8 +457,6 @@ int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser,
|
||||
|
||||
TmThreadSetCPU(tv_detect_ncpu, WORKER_CPU_SET);
|
||||
|
||||
TmThreadSetGroupName(tv_detect_ncpu, "Detect");
|
||||
|
||||
if (TmThreadSpawn(tv_detect_ncpu) != TM_ECODE_OK) {
|
||||
FatalError("TmThreadSpawn failed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user