spec: Update release and changelog

bugfix: check unsigned number flip before getting delta
bugfix: exit vmtop when arguments are invalid
bugfix: fix %ST, %GUE, %HYP formula
display: expand row size in TEXT mode
This commit is contained in:
nocjj 2020-09-21 11:55:01 +08:00
parent dc1bd70046
commit 84f4b6e4b6
5 changed files with 190 additions and 3 deletions

View File

@ -0,0 +1,50 @@
From 4eb3e65353484c6c5cf81046d7b2296151ef3b83 Mon Sep 17 00:00:00 2001
From: nocjj <1250062498@qq.com>
Date: Sat, 19 Sep 2020 14:48:06 +0800
Subject: [PATCH 4/4] bugfix: check unsigned number flip before getting delta
Sometimes, a very large number will appear in EXTxxx display items.
The reason of this phenomenon is that we do not check the size of
two unsigned numbers before getting delta value of them,
which will cause unsigned number flip.
So add check before getting delta value.
Signed-off-by: Jiajun Chen <1250062498@qq.com>
---
src/type.h | 6 +++++-
src/vmtop.c | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/type.h b/src/type.h
index 85edc52..0e92388 100644
--- a/src/type.h
+++ b/src/type.h
@@ -42,7 +42,11 @@ typedef unsigned long long u64;
static inline void DELTA_NAME(v)(struct domain *new, \
struct domain *old) \
{ \
- new->DELTA_VALUE(v) = new->v - old->v; \
+ if (new->v >= old->v) { \
+ new->DELTA_VALUE(v) = new->v - old->v; \
+ } else { \
+ new->DELTA_VALUE(v) = old->DELTA_VALUE(v); \
+ } \
}
#define SUM_NAME(v) domain_sum_ ## v
diff --git a/src/vmtop.c b/src/vmtop.c
index 18d3010..7a1b19b 100644
--- a/src/vmtop.c
+++ b/src/vmtop.c
@@ -250,7 +250,7 @@ static void show_task(struct domain *task)
int showd_field = 0;
showd_task++;
if (showd_task < begin_task ||
- showd_task - begin_task > scr_row_size - 4) {
+ showd_task - begin_task > scr_row_size - 5) {
return;
}
clrtoeol();
--
2.23.0

View File

@ -0,0 +1,28 @@
From 92239c1b444cd3f2904e2b3d7c7eaada1e9693ec Mon Sep 17 00:00:00 2001
From: nocjj <1250062498@qq.com>
Date: Sat, 19 Sep 2020 11:46:08 +0800
Subject: [PATCH 3/4] bugfix: exit vmtop when arguments are invalid
Currently if vmtop receive invalid args, vmtop will still run.
It is a abnormal behavior, so exit vmtop when arguments are invalid.
Signed-off-by: Jiajun Chen <1250062498@qq.com>
---
src/vmtop.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/vmtop.c b/src/vmtop.c
index 7cfb1b3..18d3010 100644
--- a/src/vmtop.c
+++ b/src/vmtop.c
@@ -96,6 +96,7 @@ static void parse_args(int argc, char *argv[])
break;
}
default:
+ exit(1); /* exit vmtop when args are invalid */
break;
}
}
--
2.23.0

View File

@ -0,0 +1,67 @@
From f4189eb5ddbebe0ddf58e7ea4bd25e8a5141930f Mon Sep 17 00:00:00 2001
From: nocjj <1250062498@qq.com>
Date: Mon, 14 Sep 2020 20:02:23 +0800
Subject: [PATCH 1/4] bugfix: fix %ST, %GUE, %HYP formula
Since the steal time, gtime, stime which are acquired from debugfs
count in ns unit, the usage formula should be:
usage = time * 100 / 1000000000 / delay time
And expand display align of %ST, %GUE, %HYP to avoid abnormal display.
Signed-off-by: Jiajun Chen <1250062498@qq.com>
---
src/field.c | 6 +++---
src/vmtop.c | 9 ++++++---
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/field.c b/src/field.c
index d5484b3..21be4fd 100644
--- a/src/field.c
+++ b/src/field.c
@@ -39,9 +39,9 @@ FID fields[] = {
{"EXTsum", FIELDS_DISPLAY, 10 },
{"S", FIELDS_DISPLAY, 5 },
{"P", FIELDS_DISPLAY, 5 },
- {"%ST", FIELDS_DISPLAY, 6 },
- {"%GUE", FIELDS_DISPLAY, 6 },
- {"%HYP", FIELDS_DISPLAY, 6 }
+ {"%ST", FIELDS_DISPLAY, 8 },
+ {"%GUE", FIELDS_DISPLAY, 8 },
+ {"%HYP", FIELDS_DISPLAY, 8 }
};
int get_show_field_num(void)
diff --git a/src/vmtop.c b/src/vmtop.c
index d45418b..cdf6ec4 100644
--- a/src/vmtop.c
+++ b/src/vmtop.c
@@ -219,19 +219,22 @@ static void print_domain_field(struct domain *dom, int field)
}
case FD_ST: {
print_scr("%*.1f", fields[i].align,
- (double)dom->DELTA_VALUE(steal) / 1000000.0f / delay_time);
+ (double)dom->DELTA_VALUE(steal) * 100 /
+ 1000000000.0f / delay_time);
break;
}
case FD_GUE: {
print_scr("%*.1f", fields[i].align,
- (double)dom->DELTA_VALUE(gtime) / 1000000.0f / delay_time);
+ (double)dom->DELTA_VALUE(gtime) * 100 /
+ 1000000000.0f / delay_time);
break;
}
case FD_HYP: {
u64 hyp_time = dom->DELTA_VALUE(vcpu_utime) - dom->DELTA_VALUE(gtime) +
dom->DELTA_VALUE(vcpu_stime);
print_scr("%*.1f", fields[i].align,
- (double)hyp_time / 1000000.0f / delay_time);
+ (double)hyp_time * 100 /
+ 1000000000.0f / delay_time);
break;
}
default:
--
2.23.0

View File

@ -0,0 +1,30 @@
From bd91aa4d39611d838ca60f8c3f27473e6a6b0c59 Mon Sep 17 00:00:00 2001
From: nocjj <1250062498@qq.com>
Date: Sat, 19 Sep 2020 11:36:36 +0800
Subject: [PATCH 2/4] display: expand row size in TEXT mode
Currently default row size = 1024, which means only 1024 row
will show in TEXT mode. But in some case, there are more than 1024 tasks
include vcpu, iothreads and etc. So expand default row size to 2048.
Signed-off-by: Jiajun Chen <1250062498@qq.com>
---
src/vmtop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/vmtop.c b/src/vmtop.c
index cdf6ec4..7cfb1b3 100644
--- a/src/vmtop.c
+++ b/src/vmtop.c
@@ -63,7 +63,7 @@ static void init_parameter(void)
scr_mode = TERM_MODE;
quit_flag = 0;
delay_time = 1; /* default delay 1s between display */
- scr_row_size = 1024; /* defualt size row */
+ scr_row_size = 2048; /* defualt size row */
scr_col_size = 1024; /* default size col */
}
--
2.23.0

View File

@ -1,12 +1,17 @@
Name: vmtop Name: vmtop
Version: 1.0 Version: 1.0
Release: 1 Release: 2
Summary: A tool for collecting and analyzing data of virtual machine Summary: A tool for collecting and analyzing data of virtual machine
License: Mulan PSL V2 License: Mulan PSL V2
Group: Application/System Group: Application/System
URL: https://gitee.com/openeuler/vmtop URL: https://gitee.com/openeuler/vmtop
Source:https://gitee.com/src-openeuler/vmtop/blob/master/%{name}-%{version}.tar.gz Source:https://gitee.com/src-openeuler/vmtop/blob/master/%{name}-%{version}.tar.gz
Patch0001: bugfix-fix-ST-GUE-HYP-formula.patch
Patch0002: display-expand-row-size-in-TEXT-mode.patch
Patch0003: bugfix-exit-vmtop-when-arguments-are-invalid.patch
Patch0004: bugfix-check-unsigned-number-flip-before-getting-del.patch
Requires: libvirt, ncurses Requires: libvirt, ncurses
@ -22,7 +27,8 @@ Provides: vmtop = %{version}-%{release}
This is a userspace tool which you can run it in host to help detecting VM's performance. By vmtop, you can quickly query vcpu info such as cpu usage, kvm exit times, memory usage and etc. This is a userspace tool which you can run it in host to help detecting VM's performance. By vmtop, you can quickly query vcpu info such as cpu usage, kvm exit times, memory usage and etc.
%prep %prep
%autosetup -c -n %{name}-%{version} %setup -c -n %{name}-%{version}
%autopatch -p1
%build %build
@ -46,6 +52,12 @@ install -m 550 vmtop ${RPM_BUILD_ROOT}/usr/bin/%{name}
%{_bindir}/vmtop %{_bindir}/vmtop
%changelog %changelog
* Mon Sep 21 2020 Jiajun Chen <1250062498@qq.com> - 1.0-2
- bugfix: fix %ST, %GUE, %HYP formula
- display: expand row size in TEXT mode
- bugfix: exit vmtop when arguments are invalid
- bugfix: check unsigned number flip before getting delta
* Wed Sep 09 2020 Jiajun Chen <1250062498@qq.com> - 1.0-1 * Wed Sep 09 2020 Jiajun Chen <1250062498@qq.com> - 1.0-1
- vmtopShow kvm exit items and add document to project - vmtopShow kvm exit items and add document to project