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

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 58 of file util-cpu.c.

References SC_ERR_SYSCALL, SC_ERR_SYSCONF, SCLogDebug, and SCLogError.

Referenced by GetAffinityTypeFromName(), TmModuleReceiveAFPRegister(), UtilCpuGetNumProcessorsOnline(), and UtilCpuPrintSummary().

Here is the caller graph for this function:

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 134 of file util-cpu.c.

References SC_ERR_SYSCALL, SC_ERR_SYSCONF, SCLogDebug, and SCLogError.

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 99 of file util-cpu.c.

References SC_ERR_SYSCALL, SC_ERR_SYSCONF, SCLogDebug, SCLogError, and UtilCpuGetNumProcessorsConfigured().

Referenced by AffinityGetNextCPU(), BuildCpusetWithCallback(), NFQRegisterQueue(), RunModeErfFileAutoFp(), RunModeFilePcapAutoFp(), RunModeIdsAFPRegister(), RunModeIdsPfringRegister(), RunModeSetIPSAutoFp(), RunModeSetLiveCaptureAutoFp(), and UtilCpuPrintSummary().

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t UtilCpuGetTicks ( void  )

Get the current number of ticks from the CPU.

Todo:
We'll have to deal with removig ticks from the extra cpuids inbetween 2 calls.

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

Referenced by DetectThresholdRegister(), and PacketProfileLoggertIdToString().

Here is the caller graph for this function:

void UtilCpuPrintSummary ( void  )

Print a summary of CPUs detected (configured and online)

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

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

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function: