[Oisf-users] Performance on multiple CPUs

Chris Wakelin c.d.wakelin at reading.ac.uk
Fri Aug 26 22:45:24 UTC 2011

Looks like the code's there already in src/util-cpu.c (to support
Windows); you just need to comment out the bit between "#ifdef
SYSCONF_NPROCESSORS_CONF_COMPAT" and "#elif OS_WIN32" inclusive and the
now redundant "#else" and "#endif".

Then "NUMBER_OF_PROCESSORS" is the environment variable.

Best Wishes,

On 26/08/2011 23:23, Gene Albin wrote:
> One of the smart guys here suggested a modification to suricata's source
> code that will allow it to grab the number of processors from an environment
> variable instead of from the system.  This would obviously not be something
> that the wider community would use, but I'd like to try it.
> Basically the suggestion is to change:
> nprocs = sysconf(_SC_NPROCESSORS_ONLN);
> to:
> nprocs = atoi( getenv("NPROCS") );
> Then add an environment variable that is created every time I specify the
> number of processors when creating the job:
> export NPROCS=$(cat $PBS_NODEFILE|wc –l)
> This will ensure that Suricata runs with the specified number of processors,
> and not what it sees from the system (which will be more than have been
> allocated by the job controls.  Any thoughts on that idea?
> My problem is that I don't know where or how to make that one line change to
> the Suricata source code.  Any hints on how to proceed?
> Gene
> On Fri, Aug 26, 2011 at 12:52 AM, Victor Julien <victor at inliniac.net> wrote:
>> On 08/25/2011 08:12 PM, Gene Albin wrote:
>>> Does anyone know how Suricata determines the number of CPU's available on
>>> the machine?  I'm asking because I need to know how to tell Suricata how
>>> many to use when submitting jobs on this research computer.
>>  /proc/cpuinfo
>>> always returns the total number of physical CPU's, and in my case I want
>> to
>>> test performance on a subset of the maximum (48).
>>> What environment variable, or other parameter, do I need to pass to
>> Suricata
>>> in order to specify the number of CPUs available.
>> It seems we get it from the system using:
>> nprocs = sysconf(_SC_NPROCESSORS_ONLN);
>> This can't be controlled in Suricata. Maybe it can in the system, but I
>> wouldn't know how. If you figure it out, please let us know.
>> Cheers,
>> Victor

Christopher Wakelin,                           c.d.wakelin at reading.ac.uk
IT Services Centre, The University of Reading,  Tel: +44 (0)118 378 8439
Whiteknights, Reading, RG6 2AF, UK              Fax: +44 (0)118 975 3094

More information about the Oisf-users mailing list