Skip to content

Commit

Permalink
Optimized terminal and HTML UI output when tailing multiple files.
Browse files Browse the repository at this point in the history
This should reduce the number of reflows on the TUI and on the HTML report
since it no longer sends one message per file via the WebSocket.
  • Loading branch information
allinurl committed Nov 28, 2021
1 parent 97cf7aa commit 0e808f8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/goaccess.c
Expand Up @@ -864,12 +864,6 @@ perform_tail_follow (GLog * glog) {

out:

if (!conf.output_stdout) {
tail_term ();
} else {
tail_html ();
}

return 0;
}

Expand All @@ -880,14 +874,18 @@ tail_loop_html (Logs * logs) {
.tv_sec = conf.html_refresh ? conf.html_refresh : HTML_REFRESH,
.tv_nsec = 0,
};
int i = 0;
int i = 0, ret = 0;

while (1) {
if (conf.stop_processing)
break;

for (i = 0; i < logs->size; ++i)
perform_tail_follow (&logs->glog[i]); /* 0.2 secs */
ret = perform_tail_follow (&logs->glog[i]); /* 0.2 secs */

if (0 == ret)
tail_html ();

if (nanosleep (&refresh, NULL) == -1 && errno != EINTR)
FATAL ("nanosleep: %s", strerror (errno));
}
Expand Down Expand Up @@ -989,6 +987,7 @@ term_tail_logs (Logs * logs) {
if (perform_tail_follow (&logs->glog[i]) != 0)
continue;

tail_term ();
offset = *logs->processed - logs->offset;
render_screens (offset);
if (nanosleep (&ts, NULL) == -1 && errno != EINTR) {
Expand Down

0 comments on commit 0e808f8

Please sign in to comment.