suricata
util-affinity.h File Reference
#include "suricata-common.h"
#include "conf.h"
#include "threads.h"
Include dependency graph for util-affinity.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ThreadsAffinityType_
 

Typedefs

typedef struct ThreadsAffinityType_ ThreadsAffinityType
 

Enumerations

enum  {
  RECEIVE_CPU_SET, WORKER_CPU_SET, VERDICT_CPU_SET, MANAGEMENT_CPU_SET,
  MAX_CPU_SET
}
 
enum  { BALANCED_AFFINITY, EXCLUSIVE_AFFINITY, MAX_AFFINITY }
 

Functions

void AffinitySetupLoadFromConfig (void)
 Extract cpu affinity configuration from current config file. More...
 
ThreadsAffinityTypeGetAffinityTypeFromName (const char *name)
 find affinity by its name More...
 
uint16_t AffinityGetNextCPU (ThreadsAffinityType *taf)
 Return next cpu to use for a given thread family. More...
 
uint16_t UtilAffinityGetAffinedCPUNum (ThreadsAffinityType *taf)
 
void BuildCpusetWithCallback (const char *name, ConfNode *node, void(*Callback)(int i, void *data), void *data)
 

Variables

ThreadsAffinityType thread_affinity [MAX_CPU_SET]
 

Detailed Description

Author
Eric Leblond eric@.nosp@m.regi.nosp@m.t.org

Definition in file util-affinity.h.

Typedef Documentation

◆ ThreadsAffinityType

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
RECEIVE_CPU_SET 
WORKER_CPU_SET 
VERDICT_CPU_SET 
MANAGEMENT_CPU_SET 
MAX_CPU_SET 

Definition at line 51 of file util-affinity.h.

◆ anonymous enum

anonymous enum
Enumerator
BALANCED_AFFINITY 
EXCLUSIVE_AFFINITY 
MAX_AFFINITY 

Definition at line 59 of file util-affinity.h.

Function Documentation

◆ AffinityGetNextCPU()

uint16_t AffinityGetNextCPU ( ThreadsAffinityType taf)

Return next cpu to use for a given thread family.

Return values
thecpu to used given by its id

Definition at line 282 of file util-affinity.c.

References ThreadsAffinityType_::cpu_set, ThreadsAffinityType_::lcpu, SCLogDebug, SCLogError, SCMutexLock, SCMutexUnlock, ThreadsAffinityType_::taf_mutex, and UtilCpuGetNumProcessorsOnline().

Here is the call graph for this function:

◆ AffinitySetupLoadFromConfig()

void AffinitySetupLoadFromConfig ( void  )

Extract cpu affinity configuration from current config file.

Definition at line 164 of file util-affinity.c.

Referenced by RunModeInitializeThreadSettings().

Here is the caller graph for this function:

◆ BuildCpusetWithCallback()

void BuildCpusetWithCallback ( const char *  name,
ConfNode node,
void(*)(int i, void *data)  Callback,
void *  data 
)

Definition at line 97 of file util-affinity.c.

References next, SCLogError, TAILQ_FOREACH, UtilCpuGetNumProcessorsOnline(), and ConfNode_::val.

Here is the call graph for this function:

◆ GetAffinityTypeFromName()

ThreadsAffinityType* GetAffinityTypeFromName ( const char *  name)

find affinity by its name

Return values
apointer to the affinity or NULL if not found

Definition at line 68 of file util-affinity.c.

References MAX_CPU_SET, and thread_affinity.

◆ UtilAffinityGetAffinedCPUNum()

uint16_t UtilAffinityGetAffinedCPUNum ( ThreadsAffinityType taf)

Definition at line 309 of file util-affinity.c.

References ThreadsAffinityType_::cpu_set, SCMutexLock, SCMutexUnlock, ThreadsAffinityType_::taf_mutex, and UtilCpuGetNumProcessorsOnline().

Here is the call graph for this function:

Variable Documentation

◆ thread_affinity

ThreadsAffinityType thread_affinity[MAX_CPU_SET]

store thread affinity mode for all type of threads

Definition at line 34 of file util-affinity.c.

Referenced by GetAffinityTypeFromName(), and TmThreadGetNbThreads().