mirror of
https://github.com/memtest86plus/memtest86plus.git
synced 2025-02-25 18:55:23 -06:00
Realign cache/memory size & bandwidth on line 3-6 for better readability. Add a new flag in printf to add a space between number in unit in %k mode
This commit is contained in:
parent
5580f7562d
commit
1afcd08951
@ -42,28 +42,28 @@
|
|||||||
prints(1, 20, str)
|
prints(1, 20, str)
|
||||||
|
|
||||||
#define display_l1_cache_size(size) \
|
#define display_l1_cache_size(size) \
|
||||||
printf(2, 10, "%kB", (uintptr_t)(size))
|
printf(2, 9, "%6kB", (uintptr_t)(size));
|
||||||
|
|
||||||
#define display_l2_cache_size(size) \
|
#define display_l2_cache_size(size) \
|
||||||
printf(3, 10, "%kB", (uintptr_t)(size))
|
printf(3, 9, "%6kB", (uintptr_t)(size));
|
||||||
|
|
||||||
#define display_l3_cache_size(size) \
|
#define display_l3_cache_size(size) \
|
||||||
printf(4, 10, "%kB", (uintptr_t)(size))
|
printf(4, 9, "%6kB", (uintptr_t)(size));
|
||||||
|
|
||||||
#define display_l1_cache_speed(size) \
|
|
||||||
printf(2, 19, "%kB/s", (uintptr_t)(size))
|
|
||||||
|
|
||||||
#define display_l2_cache_speed(size) \
|
|
||||||
printf(3, 19, "%kB/s", (uintptr_t)(size))
|
|
||||||
|
|
||||||
#define display_l3_cache_speed(size) \
|
|
||||||
printf(4, 19, "%kB/s", (uintptr_t)(size))
|
|
||||||
|
|
||||||
#define display_ram_speed(size) \
|
|
||||||
printf(5, 19, "%kB/s", (uintptr_t)(size))
|
|
||||||
|
|
||||||
#define display_memory_size(size) \
|
#define display_memory_size(size) \
|
||||||
printf(5, 10, "%kB", (uintptr_t)(size))
|
printf(5, 9, "%6kB", (uintptr_t)(size));
|
||||||
|
|
||||||
|
#define display_l1_cache_speed(size) \
|
||||||
|
printf(2, 18, "%S6kB/s", (uintptr_t)(size))
|
||||||
|
|
||||||
|
#define display_l2_cache_speed(size) \
|
||||||
|
printf(3, 18, "%S6kB/s", (uintptr_t)(size))
|
||||||
|
|
||||||
|
#define display_l3_cache_speed(size) \
|
||||||
|
printf(4, 18, "%S6kB/s", (uintptr_t)(size))
|
||||||
|
|
||||||
|
#define display_ram_speed(size) \
|
||||||
|
printf(5, 18, "%S6kB/s", (uintptr_t)(size))
|
||||||
|
|
||||||
#define display_dmi_mb(sys_ma, sys_sku) \
|
#define display_dmi_mb(sys_ma, sys_sku) \
|
||||||
dmicol = prints(23, dmicol, sys_man); \
|
dmicol = prints(23, dmicol, sys_man); \
|
||||||
|
18
lib/print.c
18
lib/print.c
@ -148,7 +148,7 @@ int printx(int row, int col, uintptr_t value, int field_length, bool pad, bool l
|
|||||||
return print_in_field(row, col, buffer, -length, field_length, left);
|
return print_in_field(row, col, buffer, -length, field_length, left);
|
||||||
}
|
}
|
||||||
|
|
||||||
int printk(int row, int col, uintptr_t value, int field_length, bool pad, bool left)
|
int printk(int row, int col, uintptr_t value, int field_length, bool pad, bool left, bool add_space)
|
||||||
{
|
{
|
||||||
static const char suffix[4] = { 'K', 'M', 'G', 'T' };
|
static const char suffix[4] = { 'K', 'M', 'G', 'T' };
|
||||||
|
|
||||||
@ -186,6 +186,11 @@ int printk(int row, int col, uintptr_t value, int field_length, bool pad, bool l
|
|||||||
|
|
||||||
int length = 0;
|
int length = 0;
|
||||||
buffer[length++] = suffix[scale];
|
buffer[length++] = suffix[scale];
|
||||||
|
|
||||||
|
if(add_space) {
|
||||||
|
buffer[length++] = ' ';
|
||||||
|
}
|
||||||
|
|
||||||
if (fract_length > 0) {
|
if (fract_length > 0) {
|
||||||
length += int_to_dec_str(&buffer[length], fract, fract_length, fract_length);
|
length += int_to_dec_str(&buffer[length], fract, fract_length, fract_length);
|
||||||
buffer[length++] = '.';
|
buffer[length++] = '.';
|
||||||
@ -219,13 +224,18 @@ int vprintf(int row, int col, const char *fmt, va_list args)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pad = false;
|
bool pad = false;
|
||||||
bool left = false;
|
bool left = false;
|
||||||
|
bool add_space = false;
|
||||||
int length = 0;
|
int length = 0;
|
||||||
if (*fmt == '-') {
|
if (*fmt == '-') {
|
||||||
left = true;
|
left = true;
|
||||||
fmt++;
|
fmt++;
|
||||||
}
|
}
|
||||||
|
if (*fmt == 'S') {
|
||||||
|
add_space = true;
|
||||||
|
fmt++;
|
||||||
|
}
|
||||||
if (*fmt == '0') {
|
if (*fmt == '0') {
|
||||||
pad = !left;
|
pad = !left;
|
||||||
fmt++;
|
fmt++;
|
||||||
@ -263,7 +273,7 @@ int vprintf(int row, int col, const char *fmt, va_list args)
|
|||||||
col = printx(row, col, va_arg(args, uintptr_t), length, pad, left);
|
col = printx(row, col, va_arg(args, uintptr_t), length, pad, left);
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
col = printk(row, col, va_arg(args, uintptr_t), length, pad, left);
|
col = printk(row, col, va_arg(args, uintptr_t), length, pad, left, add_space);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fmt++;
|
fmt++;
|
||||||
|
11
lib/print.h
11
lib/print.h
@ -52,11 +52,13 @@ int printx(int row, int col, uintptr_t value, int length, bool pad, bool left);
|
|||||||
/**
|
/**
|
||||||
* Prints a K<unit> value on screen starting at location (row,col) in a field of
|
* Prints a K<unit> value on screen starting at location (row,col) in a field of
|
||||||
* at least length characters, optionally padding the number with leading zeros,
|
* at least length characters, optionally padding the number with leading zeros,
|
||||||
* and optionally left-justifying instead of right-justifying in the field. The
|
* optionally left-justifying instead of right-justifying in the field, and
|
||||||
* value is shown to 3 significant figures in the nearest K/M/G/T units. Returns
|
* optionnaly adding a space between number and unit. The value is shown to
|
||||||
* the next column after the formatted value.
|
* 3 significant figures in the nearest K/M/G/T units. Returns the next column
|
||||||
|
* after the formatted value.
|
||||||
*/
|
*/
|
||||||
int printk(int row, int col, uintptr_t value, int length, bool pad, bool left);
|
int printk(int row, int col, uintptr_t value, int length,
|
||||||
|
bool pad, bool left, bool add_space);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emulates the standard printf function. Printing starts at location (row,col).
|
* Emulates the standard printf function. Printing starts at location (row,col).
|
||||||
@ -64,6 +66,7 @@ int printk(int row, int col, uintptr_t value, int length, bool pad, bool left);
|
|||||||
* The conversion flags supported are:
|
* The conversion flags supported are:
|
||||||
* - left justify
|
* - left justify
|
||||||
* 0 pad with leading zeros
|
* 0 pad with leading zeros
|
||||||
|
* S add space between number and unit (k specifier only)
|
||||||
*
|
*
|
||||||
* The conversion specifiers supported are:
|
* The conversion specifiers supported are:
|
||||||
* c character (int type)
|
* c character (int type)
|
||||||
|
Loading…
Reference in New Issue
Block a user