From 424dcf41df348da7148edfb62888358124ccd920 Mon Sep 17 00:00:00 2001 From: nocjj <1250062498@qq.com> Date: Mon, 14 Sep 2020 20:02:23 +0800 Subject: [PATCH 1/8] 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> --- bugfix-fix-ST-GUE-HYP-formula.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bugfix-fix-ST-GUE-HYP-formula.patch b/bugfix-fix-ST-GUE-HYP-formula.patch index b30e47b..20965e1 100644 --- a/bugfix-fix-ST-GUE-HYP-formula.patch +++ b/bugfix-fix-ST-GUE-HYP-formula.patch @@ -1,7 +1,7 @@ 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 +Subject: [PATCH] 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: -- Gitee From 2827a3feed2cea48c3c99fe9c446e8affd6e3208 Mon Sep 17 00:00:00 2001 From: nocjj <1250062498@qq.com> Date: Sat, 19 Sep 2020 11:36:36 +0800 Subject: [PATCH 2/8] 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> --- display-expand-row-size-in-TEXT-mode.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display-expand-row-size-in-TEXT-mode.patch b/display-expand-row-size-in-TEXT-mode.patch index 3443be3..78a1beb 100644 --- a/display-expand-row-size-in-TEXT-mode.patch +++ b/display-expand-row-size-in-TEXT-mode.patch @@ -1,7 +1,7 @@ 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 +Subject: [PATCH] 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 -- Gitee From a25f3818deabf58405d69df4db48d84948d920a4 Mon Sep 17 00:00:00 2001 From: nocjj <1250062498@qq.com> Date: Sat, 19 Sep 2020 11:46:08 +0800 Subject: [PATCH 3/8] 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> --- bugfix-exit-vmtop-when-arguments-are-invalid.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bugfix-exit-vmtop-when-arguments-are-invalid.patch b/bugfix-exit-vmtop-when-arguments-are-invalid.patch index 01cd4ed..93272a3 100644 --- a/bugfix-exit-vmtop-when-arguments-are-invalid.patch +++ b/bugfix-exit-vmtop-when-arguments-are-invalid.patch @@ -1,7 +1,7 @@ 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 +Subject: [PATCH] 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. -- Gitee From bc8ec5d279757c4f3e7d0f12edea8646171f340a Mon Sep 17 00:00:00 2001 From: nocjj <1250062498@qq.com> Date: Sat, 19 Sep 2020 14:48:06 +0800 Subject: [PATCH 4/8] 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> --- bugfix-check-unsigned-number-flip-before-getting-del.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bugfix-check-unsigned-number-flip-before-getting-del.patch b/bugfix-check-unsigned-number-flip-before-getting-del.patch index f1535a1..53eafc9 100644 --- a/bugfix-check-unsigned-number-flip-before-getting-del.patch +++ b/bugfix-check-unsigned-number-flip-before-getting-del.patch @@ -1,7 +1,7 @@ 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 +Subject: [PATCH] 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 -- Gitee From 75f6d60925f0045a508d50da67e7c09dd76692f9 Mon Sep 17 00:00:00 2001 From: Euler Robot Date: Tue, 22 Sep 2020 15:48:58 +0800 Subject: [PATCH 5/8] spec: Update patch and changelog with !5 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 Signed-off-by: Jiajun Chen <1250062498@qq.com> --- vmtop.spec | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vmtop.spec b/vmtop.spec index 15a4f68..e51143a 100644 --- a/vmtop.spec +++ b/vmtop.spec @@ -12,6 +12,10 @@ 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 +Patch0005: bugfix-fix-ST-GUE-HYP-formula.patch +Patch0006: display-expand-row-size-in-TEXT-mode.patch +Patch0007: bugfix-exit-vmtop-when-arguments-are-invalid.patch +Patch0008: bugfix-check-unsigned-number-flip-before-getting-del.patch Requires: libvirt, ncurses @@ -52,6 +56,12 @@ install -m 550 vmtop ${RPM_BUILD_ROOT}/usr/bin/%{name} %{_bindir}/vmtop %changelog +* Sat Sep 19 2020 nocjj <1250062498@qq.com> +- 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 + * 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 -- Gitee From efdca539b894a95796e39ec36d0030a72d84721b Mon Sep 17 00:00:00 2001 From: chenruyi 00589904 Date: Mon, 21 Sep 2020 16:36:36 +0800 Subject: [PATCH 6/8] vmtop: add -h and -v Signed-off-by: Ruyi Chen --- vmtop-add-h-and-v.patch | 77 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 vmtop-add-h-and-v.patch diff --git a/vmtop-add-h-and-v.patch b/vmtop-add-h-and-v.patch new file mode 100644 index 0000000..81a8896 --- /dev/null +++ b/vmtop-add-h-and-v.patch @@ -0,0 +1,77 @@ +From 5ec77f193aaf69750c74e15a1da60b4404a757d1 Mon Sep 17 00:00:00 2001 +From: chenruyi 00589904 +Date: Mon, 21 Sep 2020 16:36:36 +0800 +Subject: [PATCH] vmtop: add -h and -v + +Signed-off-by: Ruyi Chen +--- + src/field.c | 10 ++++++++++ + src/field.h | 2 ++ + src/vmtop.c | 10 +++++++++- + 3 files changed, 21 insertions(+), 1 deletion(-) + +diff --git a/src/field.c b/src/field.c +index 21be4fd..6a07fcc 100644 +--- a/src/field.c ++++ b/src/field.c +@@ -20,6 +20,16 @@ const char *filter_help = "" + "field filter - select which field to be showed\n" + "Use up/down to navigate, use space to set whether chosen filed to be showed\n" + "'q' to quit to normal display\n"; ++const char *help_text = "" ++ "usage: vmtop [option] [arg]\n" ++ "-b :output as text, which can be used for redirections\n" ++ "-d sec :set the refresh interval to secs\n" ++ "-h :print this help message and exit\n" ++ "-H :displays VM thread information\n" ++ "-n num :set the number of refresh times before automatic quit\n" ++ "-v :show VMTOP version and exit\n"; ++const char *version_text = "" ++ "vmtop-%s\n"; + + FID fields[] = { + /* name . flag . align */ +diff --git a/src/field.h b/src/field.h +index 4744ab7..ff98ee4 100644 +--- a/src/field.h ++++ b/src/field.h +@@ -48,6 +48,8 @@ typedef struct _field { + extern FID fields[]; + extern const char *summary_text; + extern const char *filter_help; ++extern const char *help_text; ++extern const char *version_text; + + int get_show_field_num(void); + #endif +diff --git a/src/vmtop.c b/src/vmtop.c +index 7a1b19b..796c67f 100644 +--- a/src/vmtop.c ++++ b/src/vmtop.c +@@ -70,7 +70,7 @@ static void init_parameter(void) + static void parse_args(int argc, char *argv[]) + { + int opt; +- char *arg_ops = "Hd:n:b"; ++ char *arg_ops = "hvHd:n:b"; + while ((opt = getopt(argc, argv, arg_ops)) != -1) { + switch (opt) { + case 'd': { +@@ -84,6 +84,14 @@ static void parse_args(int argc, char *argv[]) + thread_mode = 1; + break; + } ++ case 'h': { ++ printf(help_text); ++ exit(0); ++ } ++ case 'v': { ++ printf(version_text, PACKAGE_VERSION); ++ exit(0); ++ } + case 'n': { + display_loop = atoi(optarg); + if (display_loop == 0) { +-- +2.23.0 + -- Gitee From 50725ee04c67777938a3bdc40b3de4aa580e96c9 Mon Sep 17 00:00:00 2001 From: Euler Robot Date: Tue, 22 Sep 2020 15:48:58 +0800 Subject: [PATCH 7/8] spec: Update patch and changelog with !6 vmtop: add -h and -v Signed-off-by: Ruyi Chen --- vmtop.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vmtop.spec b/vmtop.spec index e51143a..c6dad23 100644 --- a/vmtop.spec +++ b/vmtop.spec @@ -16,6 +16,7 @@ Patch0005: bugfix-fix-ST-GUE-HYP-formula.patch Patch0006: display-expand-row-size-in-TEXT-mode.patch Patch0007: bugfix-exit-vmtop-when-arguments-are-invalid.patch Patch0008: bugfix-check-unsigned-number-flip-before-getting-del.patch +Patch0009: vmtop-add-h-and-v.patch Requires: libvirt, ncurses @@ -56,6 +57,9 @@ install -m 550 vmtop ${RPM_BUILD_ROOT}/usr/bin/%{name} %{_bindir}/vmtop %changelog +* Mon Sep 21 2020 chenruyi 00589904 +- vmtop: add -h and -v + * Sat Sep 19 2020 nocjj <1250062498@qq.com> - bugfix: fix %ST, %GUE, %HYP formula - display: expand row size in TEXT mode -- Gitee From 9c7db55f728e7e7b7ef368f666029a08e5fad1a8 Mon Sep 17 00:00:00 2001 From: Euler Robot Date: Tue, 22 Sep 2020 15:48:58 +0800 Subject: [PATCH 8/8] spec: Update release version with !5 !6 increase release verison by one Signed-off-by: Euler Robot --- vmtop.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vmtop.spec b/vmtop.spec index c6dad23..7221f47 100644 --- a/vmtop.spec +++ b/vmtop.spec @@ -1,6 +1,6 @@ Name: vmtop Version: 1.0 -Release: 2 +Release: 3 Summary: A tool for collecting and analyzing data of virtual machine License: Mulan PSL V2 Group: Application/System -- Gitee