0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-04-24 21:24:12 +00:00
netdata_netdata/libnetdata/os.h
Costa Tsaousis 55d1f00bb7
DBENGINE v2 - improvements part 12 ()
* parallel initialization of tiers

* do not spawn multiple dbengine event loops

* user configurable dbengine parallel initialization

* size netdata based on the real cpu cores available on the system netdata runs, not on the system monitored

* user configurable system cpus

* move cpuset parsing to os.c/.h

* fix replication of misaligned chart dimensions

* give a different path to each tier thread

* statically allocate the path into the initialization structure

* use aral for reusing dbengine pages

* dictionaries uses ARAL for fixed sized values

* fix compilation without internal checks

* journal v2 index uses aral

* test to see judy allocations

* judy allocations using aral

* Add config option to select if dbengine will use direct I/O (default is yes)

* V1 journafiles will use uv_fs_read instead of mmap (respect the direct I/O setting)

* Remove sqlite3IsMemdb as it is unused

* Fix compilation error when --disable-dbengine is used

* use aral for dbengine work_cmds

* changed aral API to support new features

* pgc and mrg aral overheads

* rrdeng opcodes using aral

* better structuring and naming

* dbegnine query handles using aral

* page descriptors using aral

* remove obsolete linking

* extent io descriptors using aral

* aral keeps one last page alive

* add missing return value

* added judy aral overhead

* pdc now uses aral

* page_details now use aral

* epdl and deol using aral - make sure ARALs are initialized before spawning the event loop

* remove unused linking

* pgc now uses one aral per partition

* aral measure maximum allocation queue

* aral to allocate pages in parallel

* aral parallel pages allocation when needed

* aral cleanup

* track page allocation and page population separately

---------

Co-authored-by: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com>
2023-02-02 00:14:35 +02:00

69 lines
2.2 KiB
C

// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef NETDATA_OS_H
#define NETDATA_OS_H
#include "libnetdata.h"
// =====================================================================================================================
// FreeBSD
#if __FreeBSD__
#include <sys/sysctl.h>
#define GETSYSCTL_BY_NAME(name, var) getsysctl_by_name(name, &(var), sizeof(var))
int getsysctl_by_name(const char *name, void *ptr, size_t len);
#define GETSYSCTL_MIB(name, mib) getsysctl_mib(name, mib, sizeof(mib)/sizeof(int))
int getsysctl_mib(const char *name, int *mib, size_t len);
#define GETSYSCTL_SIMPLE(name, mib, var) getsysctl_simple(name, mib, sizeof(mib)/sizeof(int), &(var), sizeof(var))
#define GETSYSCTL_WSIZE(name, mib, var, size) getsysctl_simple(name, mib, sizeof(mib)/sizeof(int), var, size)
int getsysctl_simple(const char *name, int *mib, size_t miblen, void *ptr, size_t len);
#define GETSYSCTL_SIZE(name, mib, size) getsysctl(name, mib, sizeof(mib)/sizeof(int), NULL, &(size))
#define GETSYSCTL(name, mib, var, size) getsysctl(name, mib, sizeof(mib)/sizeof(int), &(var), &(size))
int getsysctl(const char *name, int *mib, size_t miblen, void *ptr, size_t *len);
#endif
// =====================================================================================================================
// MacOS
#if __APPLE__
#include <sys/sysctl.h>
#define GETSYSCTL_BY_NAME(name, var) getsysctl_by_name(name, &(var), sizeof(var))
int getsysctl_by_name(const char *name, void *ptr, size_t len);
#endif
// =====================================================================================================================
// common defs for Apple/FreeBSD/Linux
extern const char *os_type;
#define get_system_cpus() get_system_cpus_with_cache(true, false)
#define get_system_cpus_uncached() get_system_cpus_with_cache(false, false)
long get_system_cpus_with_cache(bool cache, bool for_netdata);
unsigned long read_cpuset_cpus(const char *filename, long system_cpus);
extern pid_t pid_max;
pid_t get_system_pid_max(void);
extern unsigned int system_hz;
void get_system_HZ(void);
#include <sys/timex.h>
#if defined(__FreeBSD__) || defined(__APPLE__)
#define ADJUST_TIMEX(x) ntp_adjtime(x)
#else
#define ADJUST_TIMEX(x) adjtimex(x)
#endif
#endif //NETDATA_OS_H