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

taosdata / TDengine / #4788

14 Oct 2025 11:21AM UTC coverage: 60.992% (-2.3%) from 63.264%
#4788

push

travis-ci

web-flow
Merge 7ca9b50f9 into 19574fe21

154868 of 324306 branches covered (47.75%)

Branch coverage included in aggregate %.

207304 of 269498 relevant lines covered (76.92%)

125773493.22 hits per line

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

67.78
/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) {
54,752✔
20
  switch (stype) {
54,752!
21
    case DND_STAT_INIT:
13,136✔
22
      return "init";
13,136✔
23
    case DND_STAT_RUNNING:
27,376✔
24
      return "running";
27,376✔
25
    case DND_STAT_STOPPED:
14,240✔
26
      return "stopped";
14,240✔
27
    default:
×
28
      return "UNKNOWN";
×
29
  }
30
}
31

32
const char *dmNodeName(EDndNodeType ntype) {
4,490,087✔
33
  switch (ntype) {
4,490,087✔
34
    case VNODE:
749,439✔
35
      return "vnode";
749,439✔
36
    case QNODE:
747,471✔
37
      return "qnode";
747,471✔
38
    case SNODE:
747,471✔
39
      return "snode";
747,471✔
40
    case BNODE:
747,471✔
41
      return "bnode";
747,471✔
42
    case MNODE:
747,966✔
43
      return "mnode";
747,966✔
44
    default:
750,269✔
45
      return "dnode";
750,269✔
46
  }
47
}
48

49
void *dmSetMgmtHandle(SArray *pArray, tmsg_t msgType, void *nodeMsgFp, bool needCheckVgId) {
250,209,155✔
50
  SMgmtHandle handle = {
250,209,155✔
51
      .msgType = msgType,
52
      .msgFp = (NodeMsgFp)nodeMsgFp,
250,209,155✔
53
      .needCheckVgId = needCheckVgId,
54
  };
55

56
  return taosArrayPush(pArray, &handle);
250,209,155✔
57
}
58

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

94
int32_t dmGetDnodeId(SDnodeData *pData) { return pData->dnodeId; }
70,091,275✔
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