• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

taosdata / TDengine / #4986

15 Mar 2026 08:32AM UTC coverage: 37.305% (-31.3%) from 68.601%
#4986

push

travis-ci

tomchon
test: keep docs and unit test

125478 of 336361 relevant lines covered (37.3%)

1134847.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/source/dnode/mgmt/node_util/src/dmUtil.c
1
/*
2
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
3
 *
4
 * This program is free software: you can use, redistribute, and/or modify
5
 * it under the terms of the GNU Affero General Public License, version 3
6
 * or later ("AGPL"), as published by the Free Software Foundation.
7
 *
8
 * This program is distributed in the hope that it will be useful, but WITHOUT
9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
 * FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * You should have received a copy of the GNU Affero General Public License
13
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14
 */
15

16
#define _DEFAULT_SOURCE
17
#include "dmUtil.h"
18

19
const char *dmStatStr(EDndRunStatus stype) {
64✔
20
  switch (stype) {
64✔
21
    case DND_STAT_INIT:
16✔
22
      return "init";
16✔
23
    case DND_STAT_RUNNING:
32✔
24
      return "running";
32✔
25
    case DND_STAT_STOPPED:
16✔
26
      return "stopped";
16✔
27
    default:
×
28
      return "UNKNOWN";
×
29
  }
30
}
31

32
const char *dmNodeName(EDndNodeType ntype) {
112✔
33
  switch (ntype) {
112✔
34
    case VNODE:
16✔
35
      return "vnode";
16✔
36
    case QNODE:
16✔
37
      return "qnode";
16✔
38
    case SNODE:
16✔
39
      return "snode";
16✔
40
    case BNODE:
16✔
41
      return "bnode";
16✔
42
    case MNODE:
16✔
43
      return "mnode";
16✔
44
    case XNODE:
16✔
45
      return "xnode";
16✔
46
    default:
16✔
47
      return "dnode";
16✔
48
  }
49
}
50

51
void *dmSetMgmtHandle(SArray *pArray, tmsg_t msgType, void *nodeMsgFp, bool needCheckVgId) {
6,176✔
52
  SMgmtHandle handle = {
6,176✔
53
      .msgType = msgType,
54
      .msgFp = (NodeMsgFp)nodeMsgFp,
6,176✔
55
      .needCheckVgId = needCheckVgId,
56
  };
57

58
  return taosArrayPush(pArray, &handle);
6,176✔
59
}
60

61
void dmGetMonitorSystemInfo(SMonSysInfo *pInfo) {
×
62
  int32_t code = 0;
×
63
  code = taosGetCpuUsage(&pInfo->cpu_system, &pInfo->cpu_engine);
×
64
  if (code != 0) {
×
65
    dError("failed to get cpu usage since %s", tstrerror(code));
×
66
  }
67
  code = taosGetCpuCores(&pInfo->cpu_cores, false);
×
68
  if (code != 0) {
×
69
    dError("failed to get cpu cores since %s", tstrerror(code));
×
70
  }
71
  code = taosGetProcMemory(&pInfo->mem_engine);
×
72
  if (code != 0) {
×
73
    dError("failed to get proc memory since %s", tstrerror(code));
×
74
  }
75
  code = taosGetSysMemory(&pInfo->mem_system, &pInfo->mem_free, &pInfo->mem_cacheBuffer);
×
76
  if (code != 0) {
×
77
    dError("failed to get sys memory since %s", tstrerror(code));
×
78
  }
79
  pInfo->mem_total = tsTotalMemoryKB;
×
80
  pInfo->disk_engine = 0;
×
81
  pInfo->disk_used = tsDataSpace.size.used;
×
82
  pInfo->disk_total = tsDataSpace.size.total;
×
83
  code = taosGetCardInfoDelta(&pInfo->net_in, &pInfo->net_out);
×
84
  if (code != 0) {
×
85
    dError("failed to get card info since %s", tstrerror(code));
×
86
    taosSetDefaultCardInfoDelta(&pInfo->net_in, &pInfo->net_out);
×
87
  }
88
  code = taosGetProcIODelta(&pInfo->io_read, &pInfo->io_write, &pInfo->io_read_disk, &pInfo->io_write_disk);
×
89
  if (code != 0) {
×
90
    dError("failed to get proc io delta since %s", tstrerror(code));
×
91
    taosSetDefaultProcIODelta(&pInfo->io_read, &pInfo->io_write, &pInfo->io_read_disk, &pInfo->io_write_disk);
×
92
  }
93
  return;
×
94
}
95

96
int32_t dmGetDnodeId(SDnodeData *pData) { return pData->dnodeId; }
187✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc