mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-13 04:34: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,24 +88,24 @@ static void NetworkIOMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, s
|
||||
|
||||
static void NetworkIOMeter_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;
|
||||
}
|
||||
|
||||
char buffer[64];
|
||||
|
||||
RichString_write(out, CRT_colors[METER_TEXT], "rx: ");
|
||||
RichString_writeAscii(out, CRT_colors[METER_TEXT], "rx: ");
|
||||
Meter_humanUnit(buffer, cached_rxb_diff, sizeof(buffer));
|
||||
RichString_append(out, CRT_colors[METER_VALUE_IOREAD], buffer);
|
||||
RichString_append(out, CRT_colors[METER_VALUE_IOREAD], "iB/s");
|
||||
RichString_appendAscii(out, CRT_colors[METER_VALUE_IOREAD], buffer);
|
||||
RichString_appendAscii(out, CRT_colors[METER_VALUE_IOREAD], "iB/s");
|
||||
|
||||
RichString_append(out, CRT_colors[METER_TEXT], " tx: ");
|
||||
RichString_appendAscii(out, CRT_colors[METER_TEXT], " tx: ");
|
||||
Meter_humanUnit(buffer, cached_txb_diff, sizeof(buffer));
|
||||
RichString_append(out, CRT_colors[METER_VALUE_IOWRITE], buffer);
|
||||
RichString_append(out, CRT_colors[METER_VALUE_IOWRITE], "iB/s");
|
||||
RichString_appendAscii(out, CRT_colors[METER_VALUE_IOWRITE], buffer);
|
||||
RichString_appendAscii(out, CRT_colors[METER_VALUE_IOWRITE], "iB/s");
|
||||
|
||||
xSnprintf(buffer, sizeof(buffer), " (%lu/%lu packets) ", cached_rxp_diff, cached_txp_diff);
|
||||
RichString_append(out, CRT_colors[METER_TEXT], buffer);
|
||||
RichString_appendAscii(out, CRT_colors[METER_TEXT], buffer);
|
||||
}
|
||||
|
||||
const MeterClass NetworkIOMeter_class = {
|
||||
|
Reference in New Issue
Block a user