mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-14 13:04:35 +03:00
Split RichString_(append|appendn|write) into wide and ascii
RichString_writeFrom takes a top spot during performance analysis due to the calls to mbstowcs() and iswprint(). Most of the time we know in advance that we are only going to print regular ASCII characters.
This commit is contained in:

committed by
BenBE

parent
5506925b34
commit
157086e750
@ -88,7 +88,7 @@ static void DiskIOMeter_updateValues(Meter* this, char* buffer, size_t len) {
|
||||
|
||||
static void DIskIOMeter_display(ATTR_UNUSED const Object* cast, RichString* out) {
|
||||
if (!hasData) {
|
||||
RichString_write(out, CRT_colors[METER_VALUE_ERROR], "no data");
|
||||
RichString_writeAscii(out, CRT_colors[METER_VALUE_ERROR], "no data");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -96,15 +96,15 @@ static void DIskIOMeter_display(ATTR_UNUSED const Object* cast, RichString* out)
|
||||
|
||||
int color = cached_utilisation_diff > 40.0 ? METER_VALUE_NOTICE : METER_VALUE;
|
||||
xSnprintf(buffer, sizeof(buffer), "%.1f%%", cached_utilisation_diff);
|
||||
RichString_write(out, CRT_colors[color], buffer);
|
||||
RichString_writeAscii(out, CRT_colors[color], buffer);
|
||||
|
||||
RichString_append(out, CRT_colors[METER_TEXT], " read: ");
|
||||
RichString_appendAscii(out, CRT_colors[METER_TEXT], " read: ");
|
||||
Meter_humanUnit(buffer, cached_read_diff, sizeof(buffer));
|
||||
RichString_append(out, CRT_colors[METER_VALUE_IOREAD], buffer);
|
||||
RichString_appendAscii(out, CRT_colors[METER_VALUE_IOREAD], buffer);
|
||||
|
||||
RichString_append(out, CRT_colors[METER_TEXT], " write: ");
|
||||
RichString_appendAscii(out, CRT_colors[METER_TEXT], " write: ");
|
||||
Meter_humanUnit(buffer, cached_write_diff, sizeof(buffer));
|
||||
RichString_append(out, CRT_colors[METER_VALUE_IOWRITE], buffer);
|
||||
RichString_appendAscii(out, CRT_colors[METER_VALUE_IOWRITE], buffer);
|
||||
}
|
||||
|
||||
const MeterClass DiskIOMeter_class = {
|
||||
|
Reference in New Issue
Block a user