#include "common.h"
#include "network-live.h"
-#include "lttng-index.h"
+#include "ctf-index.h"
#define DEFAULT_FILE_ARRAY_SIZE 1
const char *opt_input_path;
static int opt_textdump;
static int opt_child;
+static int opt_begin;
int quit = 0;
OPT_HOSTNAME,
OPT_RELAY_HOSTNAME,
OPT_KPROBES,
+ OPT_BEGIN,
};
static struct poptOption long_options[] = {
{ "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL },
{ "textdump", 't', POPT_ARG_NONE, NULL, OPT_TEXTDUMP, NULL, NULL },
{ "child", 'f', POPT_ARG_NONE, NULL, OPT_CHILD, NULL, NULL },
+ { "begin", 'b', POPT_ARG_NONE, NULL, OPT_BEGIN, NULL, NULL },
{ "pid", 'p', POPT_ARG_STRING, &opt_tid, OPT_PID, NULL, NULL },
{ "hostname", 'n', POPT_ARG_STRING, &opt_hostname, OPT_HOSTNAME, NULL, NULL },
{ "relay-hostname", 'r', POPT_ARG_STRING, &opt_relay_hostname,
void usage(FILE *fp)
{
fprintf(fp, "LTTngTop %s\n\n", VERSION);
- fprintf(fp, "Usage : lttngtop [OPTIONS] [TRACE]\n");
- fprintf(fp, " TRACE Path to the trace to analyse (no trace path for live tracing)\n");
+ fprintf(fp, "Usage : lttngtop [OPTIONS] TRACE\n");
+ fprintf(fp, " TRACE Path to the trace to analyse (-r for network live tracing, nothing for mmap live streaming)\n");
fprintf(fp, " -h, --help This help message\n");
fprintf(fp, " -t, --textdump Display live events in text-only\n");
fprintf(fp, " -p, --pid Comma-separated list of PIDs to display\n");
fprintf(fp, " -f, --child Follow threads associated with selected PIDs\n");
fprintf(fp, " -n, --hostname Comma-separated list of hostnames to display (require hostname context in trace)\n");
fprintf(fp, " -k, --kprobes Comma-separated list of kprobes to insert (same format as lttng enable-event)\n");
+ fprintf(fp, " -r, --relay-hostname Network live streaming : hostname of the lttng-relayd (default port)\n");
+ fprintf(fp, " -b, --begin Network live streaming : read the trace for the beginning of the recording\n");
}
/*
tmp_str = strtok(NULL, ",");
}
break;
+ case OPT_BEGIN:
+ /* start reading the live trace from the beginning */
+ opt_begin = 1;
+ break;
case OPT_HOSTNAME:
toggle_filter = 1;
tmp_str = strtok(opt_hostname, ",");
metafd = openat(dirfd, "metadata", O_RDONLY);
if (metafd < 0) {
close(dirfd);
- ret = -1;
continue;
} else {
int trace_id;
goto end;
#else
- fprintf(stderr, "Mmap live support not compiled\n");
+ fprintf(stderr, "[ERROR] Mmap live support not compiled, specify a "
+ "trace directory or -r <relayd hostname/IP>\n");
+ usage(stdout);
+ ret = -1;
goto end;
#endif /* LTTNGTOP_MMAP_LIVE */
} else if (!opt_input_path && remote_live) {
/* network live */
- ret = setup_network_live(opt_relay_hostname);
+ ret = setup_network_live(opt_relay_hostname, opt_begin);
if (ret < 0) {
goto end;
}
quit = 1;
pthread_join(timer_thread, NULL);
+ ret = 0;
+
end:
if (bt_ctx)
bt_context_put(bt_ctx);
- return 0;
+ return ret;
}