bind9/lib/isc/include/isc/os.h
Petr Menšík f00f521e9c Use detected cache line size
IBM power architecture has L1 cache line size equal to 128.  Take
advantage of that on that architecture, do not force more common value
of 64.  When it is possible to detect higher value, use that value
instead.  Keep the default to be 64.
2022-01-27 13:02:23 +01:00

45 lines
1.1 KiB
C

/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
#pragma once
/*! \file isc/os.h */
#include <isc/lang.h>
#include <isc/types.h>
ISC_LANG_BEGINDECLS
/*%<
* Hardcode the L1 cacheline size of the CPU to 64, this is checked in
* the os.c library constructor if operating system provide means to
* get the L1 cacheline size using sysconf().
*/
#define ISC_OS_CACHELINE_SIZE 64
unsigned int
isc_os_ncpus(void);
/*%<
* Return the number of CPUs available on the system, or 1 if this cannot
* be determined.
*/
unsigned long
isc_os_cacheline(void);
/*%<
* Return L1 caheline size of the CPU.
* If L1 cache is greater than ISC_OS_CACHELINE_SIZE, ensure it is used
* instead of constant. Is common on ppc64le architecture.
*/
ISC_LANG_ENDDECLS