mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 21:31:28 +02:00
MINOR: trace: don't call strlen() on the thread-id numeric encoding
In __trace(), we're making an integer for the thread id but this one is passed through strlen() in the call to ist() because it's not a constant. We do know that it's exactly 3 chars long so we can manage this using ist2() and pass it the length instead in order to reduce the number of calls to strlen(). Also let's note that the thread number will no longer be numeric for thread numbers above 100.
This commit is contained in:
parent
d53ad49ad1
commit
06fa9f717f
@ -285,7 +285,7 @@ void __trace(enum trace_level level, uint64_t mask, struct trace_source *src,
|
|||||||
tnum[1] = '0' + tid % 10;
|
tnum[1] = '0' + tid % 10;
|
||||||
tnum[2] = '|';
|
tnum[2] = '|';
|
||||||
tnum[3] = 0;
|
tnum[3] = 0;
|
||||||
line[words++] = ist(tnum);
|
line[words++] = ist2(tnum, 3);
|
||||||
line[words++] = src->name;
|
line[words++] = src->name;
|
||||||
line[words++] = ist("|");
|
line[words++] = ist("|");
|
||||||
line[words++] = ist2("012345" + level, 1); // "0" to "5"
|
line[words++] = ist2("012345" + level, 1); // "0" to "5"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user