Tor  0.4.7.0-alpha-dev
Macros | Functions
numcpus.c File Reference

Compute the number of CPUs configured on this system. More...

#include "orconfig.h"
#include "lib/thread/numcpus.h"
#include "lib/log/log.h"
#include "lib/log/util_bug.h"
#include <stdlib.h>

Go to the source code of this file.

Macros

#define MAX_DETECTABLE_CPUS   16
 

Functions

static int compute_num_cpus_impl (void)
 
int compute_num_cpus (void)
 

Detailed Description

Compute the number of CPUs configured on this system.

Definition in file numcpus.c.

Function Documentation

◆ compute_num_cpus()

int compute_num_cpus ( void  )

Return how many CPUs we are running with. We assume that nobody is using hot-swappable CPUs, so we don't recompute this after the first time. Return -1 if we don't know how to tell the number of CPUs on this system.

Definition at line 81 of file numcpus.c.

Referenced by get_num_cpus().

◆ compute_num_cpus_impl()

static int compute_num_cpus_impl ( void  )
static

Implementation logic for compute_num_cpus().

Definition at line 27 of file numcpus.c.

Referenced by compute_num_cpus().