summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2019-06-24 13:27:44 +0300
committerMarius Vlad <marius.vlad@collabora.com>2019-07-18 13:34:04 +0300
commitb5ac5a9aa1831295f05fc574747755acef9f3da9 (patch)
tree0d0d8c0a10be8b998402780333890acc659d6b95
parent9c3804f8d5972e243d35997e8d5733c57d4eaab0 (diff)
compositor: Plug-in the flight recorder
Create a flight recorder subscriber and allow subscribring to scopes over the command line. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
-rw-r--r--compositor/main.c18
-rw-r--r--man/weston.man6
2 files changed, 24 insertions, 0 deletions
diff --git a/compositor/main.c b/compositor/main.c
index be5cfea8..7e423d1c 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -66,6 +66,8 @@
#include "../remoting/remoting-plugin.h"
#define WINDOW_TITLE "Weston Compositor"
+/* flight recorder size (in bytes) */
+#define DEFAULT_FLIGHT_REC_SIZE (5 * 1024 * 1024)
struct wet_output_config {
int width;
@@ -645,6 +647,9 @@ usage(int error_code)
" -l, --logger-scopes=SCOPE\n\t\t\tSpecify log scopes to "
"subscribe to.\n\t\t\tCan specify multiple scopes, "
"each followed by comma\n"
+ " -f, --flight-rec-scopes=SCOPE\n\t\t\tSpecify log scopes to "
+ "subscribe to.\n\t\t\tCan specify multiple scopes, "
+ "each followed by comma\n"
" -h, --help\t\tThis help message\n\n");
#if defined(BUILD_DRM_COMPOSITOR)
@@ -2937,6 +2942,7 @@ int main(int argc, char *argv[])
char *option_modules = NULL;
char *log = NULL;
char *log_scopes = NULL;
+ char *flight_rec_scopes = NULL;
char *server_socket = NULL;
int32_t idle_time = -1;
int32_t help = 0;
@@ -2954,6 +2960,7 @@ int main(int argc, char *argv[])
struct wet_compositor wet = { 0 };
struct weston_log_context *log_ctx = NULL;
struct weston_log_subscriber *logger = NULL;
+ struct weston_log_subscriber *flight_rec = NULL;
int require_input;
sigset_t mask;
@@ -2977,6 +2984,7 @@ int main(int argc, char *argv[])
{ WESTON_OPTION_BOOLEAN, "wait-for-debugger", 0, &wait_for_debugger },
{ WESTON_OPTION_BOOLEAN, "debug", 0, &debug_protocol },
{ WESTON_OPTION_STRING, "logger-scopes", 'l', &log_scopes },
+ { WESTON_OPTION_STRING, "flight-rec-scopes", 'f', &flight_rec_scopes },
};
wl_list_init(&wet.layoutput_list);
@@ -3016,6 +3024,15 @@ int main(int argc, char *argv[])
else
weston_log_subscribe(log_ctx, logger, "log");
+ flight_rec = weston_log_subscriber_create_flight_rec(DEFAULT_FLIGHT_REC_SIZE);
+ if (flight_rec_scopes) {
+ weston_log_setup_scopes(log_ctx, flight_rec, flight_rec_scopes);
+ } else {
+ /* subscribe to both 'log' and 'drm-backend' scope */
+ weston_log_subscribe(log_ctx, flight_rec, "log");
+ weston_log_subscribe(log_ctx, flight_rec, "drm-backend");
+ }
+
weston_log("%s\n"
STAMP_SPACE "%s\n"
STAMP_SPACE "Bug reports to: %s\n"
@@ -3223,6 +3240,7 @@ out:
weston_log_ctx_compositor_destroy(wet.compositor);
weston_compositor_destroy(wet.compositor);
weston_log_subscriber_destroy_log(logger);
+ weston_log_subscriber_destroy_flight_rec(flight_rec);
out_signals:
for (i = ARRAY_LENGTH(signals) - 1; i >= 0; i--)
diff --git a/man/weston.man b/man/weston.man
index 1330a20d..5d20c03e 100644
--- a/man/weston.man
+++ b/man/weston.man
@@ -153,6 +153,12 @@ the log "log" scope will be subscribed by default. Useful to control which
streams to write data into the logger and can be helpful in diagnosing early
start-up code.
.TP
+\fB\-\^f\fIscope1,scope2\fR, \fB\-\-flight-rec-scopes\fR=\fIscope1,scope2\fR
+Specify to which scopes should subscribe to. Useful to control which streams to
+write data into the flight recorder. Flight recorder has limited space, once
+the flight recorder is full new data will overwrite the old data. Without any
+scopes specified, it subscribes to 'log' and 'drm-backend' scopes.
+.TP
.BR \-\-version
Print the program version.
.TP