Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
f0739fc5
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f0739fc5
编写于
6月 15, 2011
作者:
M
Matthias Bolte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add node prefix to virNodeGet(CPU|Memory)Stats structs and defines
上级
ad7b3276
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
103 addition
and
108 deletion
+103
-108
daemon/remote.c
daemon/remote.c
+2
-2
include/libvirt/libvirt.h.in
include/libvirt/libvirt.h.in
+47
-52
src/driver.h
src/driver.h
+2
-2
src/libvirt.c
src/libvirt.c
+19
-19
src/nodeinfo.c
src/nodeinfo.c
+20
-20
src/nodeinfo.h
src/nodeinfo.h
+2
-2
src/remote/remote_driver.c
src/remote/remote_driver.c
+2
-2
tools/virsh.c
tools/virsh.c
+9
-9
未找到文件。
daemon/remote.c
浏览文件 @
f0739fc5
...
...
@@ -1450,7 +1450,7 @@ remoteDispatchNodeGetCPUStats (struct qemud_server *server ATTRIBUTE_UNUSED,
remote_node_get_cpu_stats_args
*
args
,
remote_node_get_cpu_stats_ret
*
ret
)
{
virCPUStatsPtr
params
=
NULL
;
vir
Node
CPUStatsPtr
params
=
NULL
;
int
i
;
int
cpuNum
=
args
->
cpuNum
;
int
nparams
=
args
->
nparams
;
...
...
@@ -1527,7 +1527,7 @@ remoteDispatchNodeGetMemoryStats (struct qemud_server *server ATTRIBUTE_UNUSED,
remote_node_get_memory_stats_args
*
args
,
remote_node_get_memory_stats_ret
*
ret
)
{
virMemoryStatsPtr
params
=
NULL
;
vir
Node
MemoryStatsPtr
params
=
NULL
;
int
i
;
int
cellNum
=
args
->
cellNum
;
int
nparams
=
args
->
nparams
;
...
...
include/libvirt/libvirt.h.in
浏览文件 @
f0739fc5
...
...
@@ -340,135 +340,130 @@ struct _virNodeInfo {
};
/**
* VIR_CPU_STATS_FIELD_LENGTH:
* VIR_
NODE_
CPU_STATS_FIELD_LENGTH:
*
* Macro providing the field length of virNodeCPUStats
*/
#define VIR_CPU_STATS_FIELD_LENGTH 80
#define VIR_
NODE_
CPU_STATS_FIELD_LENGTH 80
/**
* VIR_CPU_STATS_ALL_CPUS:
* VIR_
NODE_
CPU_STATS_ALL_CPUS:
*
* Macro for the total CPU time/utilization
*/
#define VIR_CPU_STATS_ALL_CPUS (-1)
#define VIR_
NODE_
CPU_STATS_ALL_CPUS (-1)
/**
* VIR_CPU_STATS_KERNEL:
* VIR_
NODE_
CPU_STATS_KERNEL:
*
* Macro for the cumulative CPU time which was spent by the kernel,
* since the node booting up (in nanoseconds).
*/
#define VIR_CPU_STATS_KERNEL "kernel"
#define VIR_
NODE_
CPU_STATS_KERNEL "kernel"
/**
* VIR_CPU_STATS_USER:
* VIR_
NODE_
CPU_STATS_USER:
*
* The cumulative CPU time which was spent by user processes,
* since the node booting up (in nanoseconds).
*/
#define VIR_CPU_STATS_USER "user"
#define VIR_
NODE_
CPU_STATS_USER "user"
/**
* VIR_CPU_STATS_IDLE:
* VIR_
NODE_
CPU_STATS_IDLE:
*
* The cumulative idle CPU time,
* since the node booting up (in nanoseconds).
*/
#define VIR_CPU_STATS_IDLE "idle"
#define VIR_
NODE_
CPU_STATS_IDLE "idle"
/**
* VIR_CPU_STATS_IOWAIT:
* VIR_
NODE_
CPU_STATS_IOWAIT:
*
* The cumulative I/O wait CPU time,
* since the node booting up (in nanoseconds).
*/
#define VIR_CPU_STATS_IOWAIT "iowait"
#define VIR_
NODE_
CPU_STATS_IOWAIT "iowait"
/**
* VIR_CPU_STATS_UTILIZATION:
* VIR_
NODE_
CPU_STATS_UTILIZATION:
*
* The CPU utilization of a node.
* The usage value is in percent and 100% represents all CPUs of
* the node.
*/
#define VIR_CPU_STATS_UTILIZATION "utilization"
#define VIR_
NODE_
CPU_STATS_UTILIZATION "utilization"
/**
* virCPUStats:
* vir
Node
CPUStats:
*
* a virNodeCPUStats is a structure filled by virNodeGetCPUStats()
* providing information about the CPU stats of the node.
*/
typedef
struct
_vir
CPUStats
vir
CPUStats
;
typedef
struct
_vir
NodeCPUStats
virNode
CPUStats
;
struct
_virCPUStats
{
char
field
[
VIR_CPU_STATS_FIELD_LENGTH
];
struct
_vir
Node
CPUStats
{
char
field
[
VIR_
NODE_
CPU_STATS_FIELD_LENGTH
];
unsigned
long
long
value
;
};
/**
* VIR_MEMORY_STATS_FIELD_LENGTH:
* VIR_
NODE_
MEMORY_STATS_FIELD_LENGTH:
*
* Macro providing the field length of virMemoryStats
* Macro providing the field length of vir
Node
MemoryStats
*/
#define VIR_MEMORY_STATS_FIELD_LENGTH 80
#define VIR_
NODE_
MEMORY_STATS_FIELD_LENGTH 80
/**
* VIR_MEMORY_STATS_ALL_CELLS:
* VIR_
NODE_
MEMORY_STATS_ALL_CELLS:
*
* Macro for the total memory of all cells.
*/
#define VIR_MEMORY_STATS_ALL_CELLS (-1)
#define VIR_
NODE_
MEMORY_STATS_ALL_CELLS (-1)
/**
* VIR_MEMORY_STATS_TOTAL:
* VIR_
NODE_
MEMORY_STATS_TOTAL:
*
* Macro for the total memory of specified cell:
* it represents the maximum memory.
*/
#define VIR_MEMORY_STATS_TOTAL "total"
#define VIR_NODE_MEMORY_STATS_TOTAL "total"
/**
* VIR_MEMORY_STATS_FREE:
* VIR_
NODE_
MEMORY_STATS_FREE:
*
* Macro for the free memory of specified cell:
* On Linux, it includes buffer and cached memory, in case of
* VIR_MEMORY_STATS_ALL_CELLS.
* VIR_
NODE_
MEMORY_STATS_ALL_CELLS.
*/
#define VIR_MEMORY_STATS_FREE "free"
#define VIR_NODE_MEMORY_STATS_FREE "free"
/**
* VIR_MEMORY_STATS_BUFFERS:
* VIR_
NODE_
MEMORY_STATS_BUFFERS:
*
* Macro for the buffer memory: On Linux, it is only returned in case of
* VIR_MEMORY_STATS_ALL_CELLS.
* VIR_
NODE_
MEMORY_STATS_ALL_CELLS.
*/
#define VIR_MEMORY_STATS_BUFFERS "buffers"
#define VIR_NODE_MEMORY_STATS_BUFFERS "buffers"
/**
* VIR_MEMORY_STATS_CACHED:
* VIR_
NODE_
MEMORY_STATS_CACHED:
*
* Macro for the cached memory: On Linux, it is only returned in case of
* VIR_MEMORY_STATS_ALL_CELLS.
* VIR_
NODE_
MEMORY_STATS_ALL_CELLS.
*/
#define VIR_MEMORY_STATS_CACHED "cached"
#define VIR_NODE_MEMORY_STATS_CACHED "cached"
/**
* virMemoryStats:
* vir
Node
MemoryStats:
*
* a virMemoryStats is a structure filled by virNodeGetMemoryStats()
* a vir
Node
MemoryStats is a structure filled by virNodeGetMemoryStats()
* providing information about the memory of the node.
*/
typedef
struct
_virNodeMemoryStats
virNodeMemoryStats
;
typedef
struct
_virMemoryStats
virMemoryStats
;
struct
_virMemoryStats
{
char
field
[
VIR_MEMORY_STATS_FIELD_LENGTH
];
struct
_virNodeMemoryStats
{
char
field
[
VIR_NODE_MEMORY_STATS_FIELD_LENGTH
];
unsigned
long
long
value
;
};
...
...
@@ -731,20 +726,20 @@ int virDomainMigrateSetMaxSpeed(virDomainPtr domain,
typedef
virNodeInfo
*
virNodeInfoPtr
;
/**
* virCPUStatsPtr:
* vir
Node
CPUStatsPtr:
*
* a vir
CPUStatsPtr is a pointer to a vir
CPUStats structure.
* a vir
NodeCPUStatsPtr is a pointer to a virNode
CPUStats structure.
*/
typedef
vir
CPUStats
*
vir
CPUStatsPtr
;
typedef
vir
NodeCPUStats
*
virNode
CPUStatsPtr
;
/**
* virMemoryStatsPtr:
* vir
Node
MemoryStatsPtr:
*
* a vir
MemoryStatsPtr is a pointer to a vir
MemoryStats structure.
* a vir
NodeMemoryStatsPtr is a pointer to a virNode
MemoryStats structure.
*/
typedef
vir
MemoryStats
*
vir
MemoryStatsPtr
;
typedef
vir
NodeMemoryStats
*
virNode
MemoryStatsPtr
;
/**
* virConnectFlags
...
...
@@ -882,13 +877,13 @@ char * virConnectGetCapabilities (virConnectPtr conn);
int
virNodeGetCPUStats
(
virConnectPtr
conn
,
int
cpuNum
,
virCPUStatsPtr
params
,
vir
Node
CPUStatsPtr
params
,
int
*
nparams
,
unsigned
int
flags
);
int
virNodeGetMemoryStats
(
virConnectPtr
conn
,
int
cellNum
,
virMemoryStatsPtr
params
,
vir
Node
MemoryStatsPtr
params
,
int
*
nparams
,
unsigned
int
flags
);
...
...
src/driver.h
浏览文件 @
f0739fc5
...
...
@@ -391,7 +391,7 @@ typedef int
(
*
virDrvNodeGetCPUStats
)
(
virConnectPtr
conn
,
int
cpuNum
,
virCPUStatsPtr
params
,
vir
Node
CPUStatsPtr
params
,
int
*
nparams
,
unsigned
int
flags
);
...
...
@@ -399,7 +399,7 @@ typedef int
(
*
virDrvNodeGetMemoryStats
)
(
virConnectPtr
conn
,
int
cellNum
,
virMemoryStatsPtr
params
,
vir
Node
MemoryStatsPtr
params
,
int
*
nparams
,
unsigned
int
flags
);
...
...
src/libvirt.c
浏览文件 @
f0739fc5
...
...
@@ -5362,7 +5362,7 @@ error:
/**
* virNodeGetCPUStats:
* @conn: pointer to the hypervisor connection.
* @cpuNum: number of node cpu. (VIR_CPU_STATS_ALL_CPUS means total cpu
* @cpuNum: number of node cpu. (VIR_
NODE_
CPU_STATS_ALL_CPUS means total cpu
* statistics)
* @params: pointer to node cpu time parameter objects
* @nparams: number of node cpu time parameter (this value should be same or
...
...
@@ -5371,23 +5371,23 @@ error:
*
* This function provides individual cpu statistics of the node.
* If you want to get total cpu statistics of the node, you must specify
* VIR_CPU_STATS_ALL_CPUS to @cpuNum.
* VIR_
NODE_
CPU_STATS_ALL_CPUS to @cpuNum.
* The @params array will be filled with the values equal to the number of
* parameters suggested by @nparams
*
* As the value of @nparams is dynamic, call the API setting @nparams to 0 and
* @params as NULL, the API returns the number of parameters supported by the
* HV by updating @nparams on SUCCESS. The caller should then allocate @params
* array, i.e. (sizeof(@virCPUStats) * @nparams) bytes and call
* array, i.e. (sizeof(@vir
Node
CPUStats) * @nparams) bytes and call
* the API again.
*
* Here is a sample code snippet:
*
* if ((virNodeGetCPUStats(conn, cpuNum, NULL, &nparams, 0) == 0) &&
* (nparams != 0)) {
* if ((params = malloc(sizeof(virCPUStats) * nparams)) == NULL)
* if ((params = malloc(sizeof(vir
Node
CPUStats) * nparams)) == NULL)
* goto error;
* memset(params, 0, sizeof(virCPUStats) * nparams);
* memset(params, 0, sizeof(vir
Node
CPUStats) * nparams);
* if (virNodeGetCPUStats(conn, cpuNum, params, &nparams, 0))
* goto error;
* }
...
...
@@ -5415,7 +5415,7 @@ error:
*/
int
virNodeGetCPUStats
(
virConnectPtr
conn
,
int
cpuNum
,
virCPUStatsPtr
params
,
vir
Node
CPUStatsPtr
params
,
int
*
nparams
,
unsigned
int
flags
)
{
VIR_DEBUG
(
"conn=%p, cpuNum=%d, params=%p, nparams=%d, flags=%u"
,
...
...
@@ -5430,7 +5430,7 @@ int virNodeGetCPUStats (virConnectPtr conn,
}
if
((
nparams
==
NULL
)
||
(
*
nparams
<
0
)
||
((
cpuNum
<
0
)
&&
(
cpuNum
!=
VIR_CPU_STATS_ALL_CPUS
)))
{
((
cpuNum
<
0
)
&&
(
cpuNum
!=
VIR_
NODE_
CPU_STATS_ALL_CPUS
)))
{
virLibConnError
(
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
goto
error
;
}
...
...
@@ -5452,8 +5452,8 @@ error:
/**
* virNodeGetMemoryStats:
* @conn: pointer to the hypervisor connection.
* @cellNum: number of node cell. (VIR_
MEMORY_STATS_ALL_CELLS means total cel
l
* statistics)
* @cellNum: number of node cell. (VIR_
NODE_MEMORY_STATS_ALL_CELLS means tota
l
*
cell
statistics)
* @params: pointer to node memory stats objects
* @nparams: number of node memory stats (this value should be same or
* less than the number of stats supported)
...
...
@@ -5461,23 +5461,23 @@ error:
*
* This function provides memory stats of the node.
* If you want to get total cpu statistics of the node, you must specify
* VIR_MEMORY_STATS_ALL_CELLS to @cellNum.
* VIR_
NODE_
MEMORY_STATS_ALL_CELLS to @cellNum.
* The @params array will be filled with the values equal to the number of
* stats suggested by @nparams
*
* As the value of @nparams is dynamic, call the API setting @nparams to 0 and
* @params as NULL, the API returns the number of parameters supported by the
* HV by updating @nparams on SUCCESS. The caller should then allocate @params
* array, i.e. (sizeof(@virMemoryStats) * @nparams) bytes and call
* array, i.e. (sizeof(@vir
Node
MemoryStats) * @nparams) bytes and call
* the API again.
*
* Here is the sample code snippet:
*
* if ((virNodeGetMemoryStats(conn, cellNum, NULL, &nparams, 0) == 0) &&
* (nparams != 0)) {
* if ((params = malloc(sizeof(virMemoryStats) * nparams)) == NULL)
* if ((params = malloc(sizeof(vir
Node
MemoryStats) * nparams)) == NULL)
* goto error;
* memset(params, cellNum, 0, sizeof(virMemoryStats) * nparams);
* memset(params, cellNum, 0, sizeof(vir
Node
MemoryStats) * nparams);
* if (virNodeGetMemoryStats(conn, params, &nparams, 0))
* goto error;
* }
...
...
@@ -5487,21 +5487,21 @@ error:
*
* Memory Stats:
*
* VIR_MEMORY_STATS_TOTAL:
* VIR_
NODE_
MEMORY_STATS_TOTAL:
* The total memory usage.(KB)
* VIR_MEMORY_STATS_FREE:
* VIR_
NODE_
MEMORY_STATS_FREE:
* The free memory usage.(KB)
* On linux, this usage includes buffers and cached.
* VIR_MEMORY_STATS_BUFFERS:
* VIR_
NODE_
MEMORY_STATS_BUFFERS:
* The buffers memory usage.(KB)
* VIR_MEMORY_STATS_CACHED:
* VIR_
NODE_
MEMORY_STATS_CACHED:
* The cached memory usage.(KB)
*
* Returns -1 in case of error, 0 in case of success.
*/
int
virNodeGetMemoryStats
(
virConnectPtr
conn
,
int
cellNum
,
virMemoryStatsPtr
params
,
vir
Node
MemoryStatsPtr
params
,
int
*
nparams
,
unsigned
int
flags
)
{
VIR_DEBUG
(
"conn=%p, cellNum=%d, params=%p, nparams=%d, flags=%u"
,
...
...
@@ -5516,7 +5516,7 @@ int virNodeGetMemoryStats (virConnectPtr conn,
}
if
((
nparams
==
NULL
)
||
(
*
nparams
<
0
)
||
((
cellNum
<
0
)
&&
(
cellNum
!=
VIR_MEMORY_STATS_ALL_CELLS
)))
{
((
cellNum
<
0
)
&&
(
cellNum
!=
VIR_
NODE_
MEMORY_STATS_ALL_CELLS
)))
{
virLibConnError
(
VIR_ERR_INVALID_ARG
,
__FUNCTION__
);
goto
error
;
}
...
...
src/nodeinfo.c
浏览文件 @
f0739fc5
...
...
@@ -72,11 +72,11 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
static
int
linuxNodeGetCPUStats
(
FILE
*
procstat
,
int
cpuNum
,
virCPUStatsPtr
params
,
vir
Node
CPUStatsPtr
params
,
int
*
nparams
);
static
int
linuxNodeGetMemoryStats
(
FILE
*
meminfo
,
int
cellNum
,
virMemoryStatsPtr
params
,
vir
Node
MemoryStatsPtr
params
,
int
*
nparams
);
/* Return the positive decimal contents of the given
...
...
@@ -396,7 +396,7 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
int
linuxNodeGetCPUStats
(
FILE
*
procstat
,
int
cpuNum
,
virCPUStatsPtr
params
,
vir
Node
CPUStatsPtr
params
,
int
*
nparams
)
{
int
ret
=
-
1
;
...
...
@@ -418,7 +418,7 @@ int linuxNodeGetCPUStats(FILE *procstat,
goto
cleanup
;
}
if
(
cpuNum
==
VIR_CPU_STATS_ALL_CPUS
)
{
if
(
cpuNum
==
VIR_
NODE_
CPU_STATS_ALL_CPUS
)
{
strcpy
(
cpu_header
,
"cpu"
);
}
else
{
snprintf
(
cpu_header
,
sizeof
(
cpu_header
),
"cpu%d"
,
cpuNum
);
...
...
@@ -439,11 +439,11 @@ int linuxNodeGetCPUStats(FILE *procstat,
}
for
(
i
=
0
;
i
<
*
nparams
;
i
++
)
{
virCPUStatsPtr
param
=
&
params
[
i
];
vir
Node
CPUStatsPtr
param
=
&
params
[
i
];
switch
(
i
)
{
case
0
:
/* fill kernel cpu time here */
if
(
virStrcpyStatic
(
param
->
field
,
VIR_CPU_STATS_KERNEL
)
==
NULL
)
{
if
(
virStrcpyStatic
(
param
->
field
,
VIR_
NODE_
CPU_STATS_KERNEL
)
==
NULL
)
{
nodeReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Field kernel cpu time too long for destination"
));
goto
cleanup
;
...
...
@@ -452,7 +452,7 @@ int linuxNodeGetCPUStats(FILE *procstat,
break
;
case
1
:
/* fill user cpu time here */
if
(
virStrcpyStatic
(
param
->
field
,
VIR_CPU_STATS_USER
)
==
NULL
)
{
if
(
virStrcpyStatic
(
param
->
field
,
VIR_
NODE_
CPU_STATS_USER
)
==
NULL
)
{
nodeReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Field kernel cpu time too long for destination"
));
goto
cleanup
;
...
...
@@ -461,7 +461,7 @@ int linuxNodeGetCPUStats(FILE *procstat,
break
;
case
2
:
/* fill idle cpu time here */
if
(
virStrcpyStatic
(
param
->
field
,
VIR_CPU_STATS_IDLE
)
==
NULL
)
{
if
(
virStrcpyStatic
(
param
->
field
,
VIR_
NODE_
CPU_STATS_IDLE
)
==
NULL
)
{
nodeReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Field kernel cpu time too long for destination"
));
goto
cleanup
;
...
...
@@ -470,7 +470,7 @@ int linuxNodeGetCPUStats(FILE *procstat,
break
;
case
3
:
/* fill iowait cpu time here */
if
(
virStrcpyStatic
(
param
->
field
,
VIR_CPU_STATS_IOWAIT
)
==
NULL
)
{
if
(
virStrcpyStatic
(
param
->
field
,
VIR_
NODE_
CPU_STATS_IOWAIT
)
==
NULL
)
{
nodeReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Field kernel cpu time too long for destination"
));
goto
cleanup
;
...
...
@@ -496,7 +496,7 @@ cleanup:
int
linuxNodeGetMemoryStats
(
FILE
*
meminfo
,
int
cellNum
,
virMemoryStatsPtr
params
,
vir
Node
MemoryStatsPtr
params
,
int
*
nparams
)
{
int
ret
=
-
1
;
...
...
@@ -504,20 +504,20 @@ int linuxNodeGetMemoryStats(FILE *meminfo,
int
found
=
0
;
int
nr_param
;
char
line
[
1024
];
char
meminfo_hdr
[
VIR_MEMORY_STATS_FIELD_LENGTH
];
char
meminfo_hdr
[
VIR_
NODE_
MEMORY_STATS_FIELD_LENGTH
];
unsigned
long
val
;
struct
field_conv
{
const
char
*
meminfo_hdr
;
// meminfo header
const
char
*
field
;
// MemoryStats field name
}
field_conv
[]
=
{
{
"MemTotal:"
,
VIR_MEMORY_STATS_TOTAL
},
{
"MemFree:"
,
VIR_MEMORY_STATS_FREE
},
{
"Buffers:"
,
VIR_MEMORY_STATS_BUFFERS
},
{
"Cached:"
,
VIR_MEMORY_STATS_CACHED
},
{
"MemTotal:"
,
VIR_
NODE_
MEMORY_STATS_TOTAL
},
{
"MemFree:"
,
VIR_
NODE_
MEMORY_STATS_FREE
},
{
"Buffers:"
,
VIR_
NODE_
MEMORY_STATS_BUFFERS
},
{
"Cached:"
,
VIR_
NODE_
MEMORY_STATS_CACHED
},
{
NULL
,
NULL
}
};
if
(
cellNum
==
VIR_MEMORY_STATS_ALL_CELLS
)
{
if
(
cellNum
==
VIR_
NODE_
MEMORY_STATS_ALL_CELLS
)
{
nr_param
=
LINUX_NB_MEMORY_STATS_ALL
;
}
else
{
nr_param
=
LINUX_NB_MEMORY_STATS_CELL
;
...
...
@@ -570,7 +570,7 @@ int linuxNodeGetMemoryStats(FILE *meminfo,
struct
field_conv
*
convp
=
&
field_conv
[
j
];
if
(
STREQ
(
meminfo_hdr
,
convp
->
meminfo_hdr
))
{
virMemoryStatsPtr
param
=
&
params
[
k
++
];
vir
Node
MemoryStatsPtr
param
=
&
params
[
k
++
];
if
(
virStrcpyStatic
(
param
->
field
,
convp
->
field
)
==
NULL
)
{
nodeReportError
(
VIR_ERR_INTERNAL_ERROR
,
...
...
@@ -637,7 +637,7 @@ int nodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, virNodeInfoPtr nodeinfo) {
int
nodeGetCPUStats
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
int
cpuNum
ATTRIBUTE_UNUSED
,
virCPUStatsPtr
params
ATTRIBUTE_UNUSED
,
vir
Node
CPUStatsPtr
params
ATTRIBUTE_UNUSED
,
int
*
nparams
ATTRIBUTE_UNUSED
,
unsigned
int
flags
)
{
...
...
@@ -666,7 +666,7 @@ int nodeGetCPUStats(virConnectPtr conn ATTRIBUTE_UNUSED,
int
nodeGetMemoryStats
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
int
cellNum
ATTRIBUTE_UNUSED
,
virMemoryStatsPtr
params
ATTRIBUTE_UNUSED
,
vir
Node
MemoryStatsPtr
params
ATTRIBUTE_UNUSED
,
int
*
nparams
ATTRIBUTE_UNUSED
,
unsigned
int
flags
)
{
...
...
@@ -678,7 +678,7 @@ int nodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED,
char
*
meminfo_path
=
NULL
;
FILE
*
meminfo
;
if
(
cellNum
==
VIR_MEMORY_STATS_ALL_CELLS
)
{
if
(
cellNum
==
VIR_
NODE_
MEMORY_STATS_ALL_CELLS
)
{
meminfo_path
=
strdup
(
MEMINFO_PATH
);
if
(
!
meminfo_path
)
{
virReportOOMError
();
...
...
src/nodeinfo.h
浏览文件 @
f0739fc5
...
...
@@ -32,12 +32,12 @@ int nodeCapsInitNUMA(virCapsPtr caps);
int
nodeGetCPUStats
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
int
cpuNum
,
virCPUStatsPtr
params
,
vir
Node
CPUStatsPtr
params
,
int
*
nparams
,
unsigned
int
flags
ATTRIBUTE_UNUSED
);
int
nodeGetMemoryStats
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
int
cellNum
,
virMemoryStatsPtr
params
,
vir
Node
MemoryStatsPtr
params
,
int
*
nparams
,
unsigned
int
flags
ATTRIBUTE_UNUSED
);
int
nodeGetCellsFreeMemory
(
virConnectPtr
conn
,
...
...
src/remote/remote_driver.c
浏览文件 @
f0739fc5
...
...
@@ -1699,7 +1699,7 @@ done:
static
int
remoteNodeGetCPUStats
(
virConnectPtr
conn
,
int
cpuNum
,
virCPUStatsPtr
params
,
int
*
nparams
,
vir
Node
CPUStatsPtr
params
,
int
*
nparams
,
unsigned
int
flags
)
{
int
rv
=
-
1
;
...
...
@@ -1765,7 +1765,7 @@ done:
static
int
remoteNodeGetMemoryStats
(
virConnectPtr
conn
,
int
cellNum
,
virMemoryStatsPtr
params
,
int
*
nparams
,
vir
Node
MemoryStatsPtr
params
,
int
*
nparams
,
unsigned
int
flags
)
{
int
rv
=
-
1
;
...
...
tools/virsh.c
浏览文件 @
f0739fc5
...
...
@@ -3910,8 +3910,8 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd)
int
i
,
j
;
bool
flag_utilization
=
false
;
bool
flag_percent
=
vshCommandOptBool
(
cmd
,
"percent"
);
int
cpuNum
=
VIR_CPU_STATS_ALL_CPUS
;
virCPUStatsPtr
params
;
int
cpuNum
=
VIR_
NODE_
CPU_STATS_ALL_CPUS
;
vir
Node
CPUStatsPtr
params
;
int
nparams
=
0
;
bool
ret
=
false
;
struct
cpu_stats
{
...
...
@@ -3955,15 +3955,15 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd)
for
(
j
=
0
;
j
<
nparams
;
j
++
)
{
unsigned
long
long
value
=
params
[
j
].
value
;
if
(
STREQ
(
params
[
j
].
field
,
VIR_CPU_STATS_KERNEL
))
{
if
(
STREQ
(
params
[
j
].
field
,
VIR_
NODE_
CPU_STATS_KERNEL
))
{
cpu_stats
[
i
].
sys
=
value
;
}
else
if
(
STREQ
(
params
[
j
].
field
,
VIR_CPU_STATS_USER
))
{
}
else
if
(
STREQ
(
params
[
j
].
field
,
VIR_
NODE_
CPU_STATS_USER
))
{
cpu_stats
[
i
].
user
=
value
;
}
else
if
(
STREQ
(
params
[
j
].
field
,
VIR_CPU_STATS_IDLE
))
{
}
else
if
(
STREQ
(
params
[
j
].
field
,
VIR_
NODE_
CPU_STATS_IDLE
))
{
cpu_stats
[
i
].
idle
=
value
;
}
else
if
(
STREQ
(
params
[
j
].
field
,
VIR_CPU_STATS_IOWAIT
))
{
}
else
if
(
STREQ
(
params
[
j
].
field
,
VIR_
NODE_
CPU_STATS_IOWAIT
))
{
cpu_stats
[
i
].
iowait
=
value
;
}
else
if
(
STREQ
(
params
[
j
].
field
,
VIR_CPU_STATS_UTILIZATION
))
{
}
else
if
(
STREQ
(
params
[
j
].
field
,
VIR_
NODE_
CPU_STATS_UTILIZATION
))
{
cpu_stats
[
i
].
util
=
value
;
flag_utilization
=
true
;
}
...
...
@@ -4037,8 +4037,8 @@ cmdNodeMemStats(vshControl *ctl, const vshCmd *cmd)
{
int
nparams
=
0
;
unsigned
int
i
=
0
;
int
cellNum
=
VIR_MEMORY_STATS_ALL_CELLS
;
virMemoryStatsPtr
params
=
NULL
;
int
cellNum
=
VIR_
NODE_
MEMORY_STATS_ALL_CELLS
;
vir
Node
MemoryStatsPtr
params
=
NULL
;
bool
ret
=
false
;
if
(
!
vshConnectionUsability
(
ctl
,
ctl
->
conn
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录