From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
To: Jingbai Ma <jingbai.ma@hp.com>
Cc: "kexec@lists.infradead.org" <kexec@lists.infradead.org>,
Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Subject: Re: [PATCH] makedumpfile: print spinner in progress information
Date: Tue, 29 Oct 2013 09:57:29 +0900 [thread overview]
Message-ID: <526F07F9.6050900@jp.fujitsu.com> (raw)
In-Reply-To: <5269DF9C.9000207@hp.com>
(2013/10/25 12:03), Jingbai Ma wrote:
> On 10/25/2013 10:57 AM, Jingbai Ma wrote:
>> On 10/25/2013 09:45 AM, HATAYAMA Daisuke wrote:
>>> On system with huge memory, percentage in progress information is
>>> updated at very slow interval, because 1 percent on 1 TiB memory is
>>> about 10 GiB, which looks like as if system has freezed. Then,
>>> confused users might get tempted to push a reset button to recover the
>>> system. We want to avoid such situation as much as possible.
>>>
>>> To address the issue, this patch adds spinner that rotates in the
>>> order of /, |, \ and - next to the progress indicator in percentage,
>>> which helps users to get aware that system is still active and crash
>>> dump process is still in progress now.
>>>
>>> This code is borrowed from diskdump code.
>>>
>>> The example is like this:
>>>
>>> Copying data : [ 0 %] /
>>> Copying data : [ 8 %] |
>>> Copying data : [ 11 %] \
>>> Copying data : [ 14 %] -
>>> Copying data : [ 16 %] /
>>> ...
>>> Copying data : [ 99 %] /
>>> Copying data : [100 %] |
>>>
>>> Signed-off-by: HATAYAMA Daisuke<d.hatayama@jp.fujitsu.com>
>>> ---
>>> print_info.c | 11 +++++++----
>>> 1 file changed, 7 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/print_info.c b/print_info.c
>>> index 3527970..879fa4b 100644
>>> --- a/print_info.c
>>> +++ b/print_info.c
>>> @@ -286,6 +286,8 @@ print_progress(const char *msg, unsigned long
>>> current, unsigned long end)
>>> int progress;
>>> time_t tm;
>>> static time_t last_time = 0;
>>> + static unsigned int lapse = 0;
>>> + const char *spinner = "/|\\-";
>>
>> I believe your spinner should be:
>> const char *spinner = "/|\-/|\-";
>>
>
> Oh, it seems not a full round, this one should be better:
> const char *spinner = "/|\-";
>
It's escape sequence.
>>>
>>> if (current< end) {
>>> tm = time(NULL);
>>> @@ -297,13 +299,14 @@ print_progress(const char *msg, unsigned long
>>> current, unsigned long end)
>>> progress = 100;
>>>
>>> if (flag_ignore_r_char) {
>>> - PROGRESS_MSG("%-" PROGRESS_MAXLEN "s: [%3d %%]\n",
>>> - msg, progress);
>>> + PROGRESS_MSG("%-" PROGRESS_MAXLEN "s: [%3d %%] %c\n",
>>> + msg, progress, spinner[lapse& 3]);
>
> And then, this line should be:
> msg, progress, spinner[lapse % 4]);
>
OK, though I think either is fine.
>>> } else {
>>> PROGRESS_MSG("\r");
>>> - PROGRESS_MSG("%-" PROGRESS_MAXLEN "s: [%3d %%] ",
>>> - msg, progress);
>>> + PROGRESS_MSG("%-" PROGRESS_MAXLEN "s: [%3d %%] %c",
>>> + msg, progress, spinner[lapse& 3]);
>
> This line too:
> msg, progress, spinner[lapse % 4]);
>
OK.
>>> }
>>> + lapse++;
>>> }
>>>
>>> void
>>
>>
>
>
--
Thanks.
HATAYAMA, Daisuke
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2013-10-29 0:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-25 1:45 [PATCH] makedumpfile: print spinner in progress information HATAYAMA Daisuke
2013-10-25 2:57 ` Jingbai Ma
2013-10-25 3:03 ` Jingbai Ma
2013-10-29 0:57 ` HATAYAMA Daisuke [this message]
2013-10-25 4:07 ` Atsushi Kumagai
2013-10-29 1:26 ` HATAYAMA Daisuke
2013-10-29 2:42 ` HATAYAMA Daisuke
2013-10-29 4:50 ` Atsushi Kumagai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=526F07F9.6050900@jp.fujitsu.com \
--to=d.hatayama@jp.fujitsu.com \
--cc=jingbai.ma@hp.com \
--cc=kexec@lists.infradead.org \
--cc=kumagai-atsushi@mxc.nes.nec.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox