2021-09-30 13:21:51 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can use, redistribute, and/or modify
|
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3
|
|
|
|
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _TD_OS_SYSINFO_H_
|
|
|
|
|
#define _TD_OS_SYSINFO_H_
|
|
|
|
|
|
2022-02-28 11:22:49 +00:00
|
|
|
#include "os.h"
|
|
|
|
|
|
2021-09-30 13:21:51 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-02-23 12:35:09 +00:00
|
|
|
typedef struct {
|
|
|
|
|
int64_t total;
|
|
|
|
|
int64_t used;
|
|
|
|
|
int64_t avail;
|
|
|
|
|
} SDiskSize;
|
|
|
|
|
|
2022-02-24 13:37:19 +00:00
|
|
|
typedef struct {
|
2022-02-23 12:35:09 +00:00
|
|
|
int64_t reserved;
|
|
|
|
|
SDiskSize size;
|
|
|
|
|
} SDiskSpace;
|
|
|
|
|
|
2022-07-20 00:39:52 +00:00
|
|
|
bool taosCheckSystemIsLittleEnd();
|
2021-09-30 13:21:51 +00:00
|
|
|
void taosGetSystemInfo();
|
2023-07-23 15:25:58 +00:00
|
|
|
int64_t taosGetOsUptime();
|
2022-03-03 09:30:33 +00:00
|
|
|
int32_t taosGetEmail(char *email, int32_t maxLen);
|
2023-07-14 05:27:19 +00:00
|
|
|
int32_t taosGetOsReleaseName(char *releaseName, char* sName, char* ver, int32_t maxLen);
|
2022-03-03 10:10:56 +00:00
|
|
|
int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores);
|
2024-07-27 10:33:08 +00:00
|
|
|
void taosGetCpuCores(float *numOfCores, bool physical);
|
2022-04-11 10:13:55 +00:00
|
|
|
void taosGetCpuUsage(double *cpu_system, double *cpu_engine);
|
2023-11-08 06:29:40 +00:00
|
|
|
int32_t taosGetCpuInstructions(char* sse42, char* avx, char* avx2, char* fma, char* avx512);
|
2022-03-03 10:10:56 +00:00
|
|
|
int32_t taosGetTotalMemory(int64_t *totalKB);
|
|
|
|
|
int32_t taosGetProcMemory(int64_t *usedKB);
|
|
|
|
|
int32_t taosGetSysMemory(int64_t *usedKB);
|
2022-03-01 09:13:12 +00:00
|
|
|
int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize);
|
2022-04-07 11:06:01 +00:00
|
|
|
void taosGetProcIODelta(int64_t *rchars, int64_t *wchars, int64_t *read_bytes, int64_t *write_bytes);
|
|
|
|
|
void taosGetCardInfoDelta(int64_t *receive_bytes, int64_t *transmit_bytes);
|
2022-03-01 09:13:12 +00:00
|
|
|
|
2021-09-30 13:21:51 +00:00
|
|
|
void taosKillSystem();
|
2022-01-04 08:21:32 +00:00
|
|
|
int32_t taosGetSystemUUID(char *uid, int32_t uidlen);
|
2022-03-01 09:13:12 +00:00
|
|
|
char *taosGetCmdlineByPID(int32_t pid);
|
2021-09-30 13:21:51 +00:00
|
|
|
void taosSetCoreDump(bool enable);
|
|
|
|
|
|
2022-03-15 13:35:04 +00:00
|
|
|
#if !defined(LINUX)
|
2022-03-11 11:39:20 +00:00
|
|
|
|
2022-10-13 03:09:43 +00:00
|
|
|
#define _UTSNAME_LENGTH 65
|
2022-03-11 11:39:20 +00:00
|
|
|
#define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH
|
|
|
|
|
|
2022-10-13 03:09:43 +00:00
|
|
|
#endif // WINDOWS
|
2022-03-11 11:39:20 +00:00
|
|
|
|
2023-02-10 05:00:55 +00:00
|
|
|
#if defined(_ALPINE)
|
|
|
|
|
|
|
|
|
|
#define _UTSNAME_LENGTH 65
|
|
|
|
|
#define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-09-30 13:21:51 +00:00
|
|
|
typedef struct {
|
2021-12-17 03:22:31 +00:00
|
|
|
char sysname[_UTSNAME_MACHINE_LENGTH];
|
|
|
|
|
char nodename[_UTSNAME_MACHINE_LENGTH];
|
|
|
|
|
char release[_UTSNAME_MACHINE_LENGTH];
|
|
|
|
|
char version[_UTSNAME_MACHINE_LENGTH];
|
|
|
|
|
char machine[_UTSNAME_MACHINE_LENGTH];
|
2021-09-30 13:21:51 +00:00
|
|
|
} SysNameInfo;
|
|
|
|
|
|
|
|
|
|
SysNameInfo taosGetSysNameInfo();
|
2022-10-13 03:09:43 +00:00
|
|
|
bool taosCheckCurrentInDll();
|
2022-12-29 01:21:20 +00:00
|
|
|
int taosGetlocalhostname(char *hostname, size_t maxLen);
|
2021-09-30 13:21:51 +00:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|