MINOR: activity: allow "show activity" to restart dumping on any line
authorWilly Tarreau <w@1wt.eu>
Wed, 3 May 2023 13:52:19 +0000 (15:52 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 3 May 2023 15:24:54 +0000 (17:24 +0200)
commit6ed0b9885d246b8035e9cdd7f59a0d37152988ae
tree5cb01c694b37001a0c4fdce8b502dcdbec40f869
parent8ee0d11cb828dfc0f8a6d8ec6324c52109900753
MINOR: activity: allow "show activity" to restart dumping on any line

When using many threads, it's difficult to see the end of "show activity"
due to the numerous columns which fill the buffer. For example a dump of
a 256-thread, freshly booted process yields around 15kB.

Here by arranging the dump in a loop around a switch/case block where
each case checks the code line number against the current dump position,
we have a restartable counter for free with a granularity of the line of
code, without having to maintain a matching between states and specific
lines. It just requires to reset the trash buffer for each line and to
try to dump it after each line.

Now dumping 256 threads after a few seconds of traffic happily emits 20kB.
src/activity.c