mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 20:24: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
20
TasksMeter.c
20
TasksMeter.c
@ -46,7 +46,7 @@ static void TasksMeter_display(const Object* cast, RichString* out) {
|
||||
int processes = (int) this->values[2];
|
||||
|
||||
xSnprintf(buffer, sizeof(buffer), "%d", processes);
|
||||
RichString_write(out, CRT_colors[METER_VALUE], buffer);
|
||||
RichString_writeAscii(out, CRT_colors[METER_VALUE], buffer);
|
||||
int threadValueColor = CRT_colors[METER_VALUE];
|
||||
int threadCaptionColor = CRT_colors[METER_TEXT];
|
||||
if (settings->highlightThreads) {
|
||||
@ -54,21 +54,21 @@ static void TasksMeter_display(const Object* cast, RichString* out) {
|
||||
threadCaptionColor = CRT_colors[PROCESS_THREAD];
|
||||
}
|
||||
if (!settings->hideUserlandThreads) {
|
||||
RichString_append(out, CRT_colors[METER_TEXT], ", ");
|
||||
RichString_appendAscii(out, CRT_colors[METER_TEXT], ", ");
|
||||
xSnprintf(buffer, sizeof(buffer), "%d", (int)this->values[1]);
|
||||
RichString_append(out, threadValueColor, buffer);
|
||||
RichString_append(out, threadCaptionColor, " thr");
|
||||
RichString_appendAscii(out, threadValueColor, buffer);
|
||||
RichString_appendAscii(out, threadCaptionColor, " thr");
|
||||
}
|
||||
if (!settings->hideKernelThreads) {
|
||||
RichString_append(out, CRT_colors[METER_TEXT], ", ");
|
||||
RichString_appendAscii(out, CRT_colors[METER_TEXT], ", ");
|
||||
xSnprintf(buffer, sizeof(buffer), "%d", (int)this->values[0]);
|
||||
RichString_append(out, threadValueColor, buffer);
|
||||
RichString_append(out, threadCaptionColor, " kthr");
|
||||
RichString_appendAscii(out, threadValueColor, buffer);
|
||||
RichString_appendAscii(out, threadCaptionColor, " kthr");
|
||||
}
|
||||
RichString_append(out, CRT_colors[METER_TEXT], "; ");
|
||||
RichString_appendAscii(out, CRT_colors[METER_TEXT], "; ");
|
||||
xSnprintf(buffer, sizeof(buffer), "%d", (int)this->values[3]);
|
||||
RichString_append(out, CRT_colors[TASKS_RUNNING], buffer);
|
||||
RichString_append(out, CRT_colors[METER_TEXT], " running");
|
||||
RichString_appendAscii(out, CRT_colors[TASKS_RUNNING], buffer);
|
||||
RichString_appendAscii(out, CRT_colors[METER_TEXT], " running");
|
||||
}
|
||||
|
||||
const MeterClass TasksMeter_class = {
|
||||
|
Reference in New Issue
Block a user