Row.c code shrink and adding a new format for Row_printNanoseconds()#1579
Row.c code shrink and adding a new format for Row_printNanoseconds()#1579fasterit merged 4 commits intohtop-dev:mainfrom
Conversation
0c14007 to
46e88a9
Compare
BenBE
left a comment
There was a problem hiding this comment.
LGTM. Although a bit unconventional to skip from ns to ms right away … Also, even though we have Unicode, for units I'd still prefer to use us unconditionally.
"1.0000ms" vs. "1000.0us" ... These are same precision for showing the fractions of a second. I don't know which one looks better. Note that the time units in the GPUMeter would have to use |
|
I'm neutral either way … |
4ff9f7a to
54d77d4
Compare
|
Can we have one "format times" code as in #1583 and this combined? |
|
https://en.wikipedia.org/wiki/Microsecond ... "Its symbol is μs, sometimes simplified to us when Unicode is not available." |
The output of #1583 is an ASCII string (
Ask @BenBE for this. Actually I wished the Greek letter mu (μ, U+03BC) be used when it's available, but a previous comment of BenBE said something about using |
54d77d4 to
fd59edc
Compare
|
Using
At least the second situation can occur easily when working with @fasterit: For me it's not a pressing issue and I'm totally indifferent about which one we use in the end. |
I'm personally neutral on this, because after #1598 it would be easier to add the μ symbol support while having |
e205322 to
de0f493
Compare
61da73e to
d0863d7
Compare
d0863d7 to
e46cc96
Compare
871e921 to
206a2e6
Compare
b3eca7c to
e7fcca1
Compare
6079c6e to
32fc21c
Compare
4958b20 to
b49c47a
Compare
6447a95 to
020cc90
Compare
b0fd573 to
33ceb06
Compare
1c3b06d to
5707d2e
Compare
dd291a0 to
78065ef
Compare
78065ef to
cc887b8
Compare
cc887b8 to
aa4b929
Compare
8db6b6a to
bc9efd3
Compare
df8bc61 to
5fa271c
Compare
5fa271c to
dcbaad9
Compare
dcbaad9 to
38d1298
Compare
38d1298 to
d4e42db
Compare
d4e42db to
7d4339f
Compare
* Reduce length of the format strings by removing redundant field width specifications (e.g. "%1u" -> "%u"). * Merge some identical function calls in conditionals. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Shorten a format string ("%1ud" -> "%ud").
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Merge two xSnprintf() calls within the function. When the time value to print is less than one second, the "%.u" format allows us to print no digits in the seconds field. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Add a new format: "1.0000ms" - "9.9999ms". Previously they would print as ".001000s" and ".009999s", and this new format adds one extra digit of precision. Note that I print the unit as "ms" rather than microseconds; this saves code for deciding whether to print the Greek "mu" or the Latin "u". Row_printNanoseconds() now prints this list of formats: " 0ns", "999999ns", "1.0000ms", "9.9999ms", ".010000s", ".999999s", "1.00000s", "59.9999s", "1:00.000", "9:59.999", "10:00.00" ... Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
7d4339f to
43a7fd3
Compare
The first three commits are code shrinks.
The last one commit adds a new format for Row_printNanoseconds() because I feel I missed a chance of allowing one extra digit of precision to be printed.
The last commit is optional. If people feel the new format is not worth it, I can drop that commit.
(Follow-up of #1425)