summaryrefslogtreecommitdiffstats
path: root/NetworkIOMeter.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-12-04 14:44:57 +0100
committerBenBE <BenBE@geshi.org>2020-12-08 20:58:40 +0100
commit157086e750187f6bceeea697d10bf58403c7d5de (patch)
tree82c6512c1a1e88c9ab9f77ca9bf1531da265e331 /NetworkIOMeter.c
parent5506925b346b09f8556ce2c8f83fe3d69dc1c03c (diff)
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.
Diffstat (limited to 'NetworkIOMeter.c')
-rw-r--r--NetworkIOMeter.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/NetworkIOMeter.c b/NetworkIOMeter.c
index 90ec9909..a898b311 100644
--- a/NetworkIOMeter.c
+++ b/NetworkIOMeter.c
@@ -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 = {

© 2014-2024 Faster IT GmbH | imprint | privacy policy