suricata
util-cpu.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

uint16_t UtilCpuGetNumProcessorsConfigured (void)
 Get the number of cpus configured in the system. More...
 
uint16_t UtilCpuGetNumProcessorsOnline (void)
 Get the number of cpus online in the system. More...
 
uint16_t UtilCpuGetNumProcessorsMax (void)
 Get the maximum number of cpus allowed in the system This syscall is present on Solaris, but it's not on linux or macosx. Maybe you should look at UtilCpuGetNumProcessorsConfigured() More...
 
void UtilCpuPrintSummary (void)
 Print a summary of CPUs detected (configured and online) More...
 
uint64_t UtilCpuGetTicks (void)
 

Detailed Description

Function Documentation

◆ UtilCpuGetNumProcessorsConfigured()

uint16_t UtilCpuGetNumProcessorsConfigured ( void  )

Get the number of cpus configured in the system.

Ok, if they should use sysconf, check that they have the macro's (syscalls) defined;

Note: For windows it's different; Check the following: SYSTEM_INFO info; GetSystemInfo(&info); -> info.dwNumberOfProcessors;

Return values
0if the syscall is not available or we have an error; otherwise it will return the number of cpus configured

Definition at line 59 of file util-cpu.c.

References SCLogDebug, SCLogError, SCLogWarning, and StringParseInt64().

Referenced by UtilCpuGetNumProcessorsOnline(), and UtilCpuPrintSummary().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UtilCpuGetNumProcessorsMax()

uint16_t UtilCpuGetNumProcessorsMax ( void  )

Get the maximum number of cpus allowed in the system This syscall is present on Solaris, but it's not on linux or macosx. Maybe you should look at UtilCpuGetNumProcessorsConfigured()

Return values
0if the syscall is not available or we have an error; otherwise it will return the number of cpus allowed

Definition at line 144 of file util-cpu.c.

References SCLogDebug, and SCLogError.

◆ UtilCpuGetNumProcessorsOnline()

uint16_t UtilCpuGetNumProcessorsOnline ( void  )

Get the number of cpus online in the system.

Return values
0if the syscall is not available or we have an error; otherwise it will return the number of cpus online

Definition at line 108 of file util-cpu.c.

References SCLogDebug, SCLogError, and UtilCpuGetNumProcessorsConfigured().

Referenced by AffinityGetNextCPU(), BuildCpusetWithCallback(), NFQRegisterQueue(), RunModeErfFileAutoFp(), RunModeFilePcapAutoFp(), TmThreadsGetWorkerThreadMax(), UtilAffinityGetAffinedCPUNum(), and UtilCpuPrintSummary().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UtilCpuGetTicks()

uint64_t UtilCpuGetTicks ( void  )

Get the current number of ticks from the CPU.

Todo:
We'll have to deal with removing ticks from the extra cpuids in between 2 calls.

Definition at line 194 of file util-cpu.c.

◆ UtilCpuPrintSummary()

void UtilCpuPrintSummary ( void  )

Print a summary of CPUs detected (configured and online)

Definition at line 173 of file util-cpu.c.

References SCLogDebug, SCLogInfo, UtilCpuGetNumProcessorsConfigured(), and UtilCpuGetNumProcessorsOnline().

Here is the call graph for this function: