suricata
util-cpu.c File Reference
#include "suricata-common.h"
#include "util-error.h"
#include "util-debug.h"
#include "util-cpu.h"
#include "util-byte.h"
Include dependency graph for util-cpu.c:

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...
 
void UtilCpuPrintSummary (void)
 Print a summary of CPUs detected (configured and online) More...
 
uint64_t UtilCpuGetTicks (void)
 

Detailed Description

Author
Pablo Rincon Crespo pablo.nosp@m..rin.nosp@m.con.c.nosp@m.resp.nosp@m.o@gma.nosp@m.il.c.nosp@m.om

Retrieve CPU information (configured CPUs, online CPUs)

Definition in file util-cpu.c.

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:

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

◆ UtilCpuPrintSummary()

void UtilCpuPrintSummary ( void  )

Print a summary of CPUs detected (configured and online)

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

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

Here is the call graph for this function: