From 313b377139551fa3e8a1a7cb8783b210f8bed439 Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 27 Jul 2006 21:05:33 +0000 Subject: [PATCH] update ltt control git-svn-id: http://ltt.polymtl.ca/svn@2022 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt-control/liblttctl/liblttctl.c | 3 ++- ltt-control/liblttctl/lttctl.h | 3 ++- ltt-control/lttctl/lttctl.c | 18 +++++++++++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ltt-control/liblttctl/liblttctl.c b/ltt-control/liblttctl/liblttctl.c index d6f411b9..c73c7e59 100644 --- a/ltt-control/liblttctl/liblttctl.c +++ b/ltt-control/liblttctl/liblttctl.c @@ -298,7 +298,7 @@ int lttctl_destroy_handle(struct lttctl_handle *h) int lttctl_create_trace(const struct lttctl_handle *h, - char *name, enum trace_mode mode, unsigned subbuf_size, unsigned n_subbufs) + char *name, enum trace_mode mode, char *trace_type, unsigned subbuf_size, unsigned n_subbufs) { int err; @@ -320,6 +320,7 @@ int lttctl_create_trace(const struct lttctl_handle *h, req.nlh.nlmsg_seq = 0; strncpy(req.msg.trace_name, name, NAME_MAX); + strncpy(req.msg.trace_type, trace_type, NAME_MAX); req.msg.op = OP_CREATE; req.msg.args.new_trace.mode = mode; req.msg.args.new_trace.subbuf_size = subbuf_size; diff --git a/ltt-control/liblttctl/lttctl.h b/ltt-control/liblttctl/lttctl.h index cc028a57..fc5a4f9c 100644 --- a/ltt-control/liblttctl/lttctl.h +++ b/ltt-control/liblttctl/lttctl.h @@ -47,6 +47,7 @@ enum trace_mode { typedef struct lttctl_peer_msg { char trace_name[NAME_MAX]; + char trace_type[NAME_MAX]; enum trace_op op; union { struct { @@ -76,7 +77,7 @@ int lttctl_destroy_handle(struct lttctl_handle *h); int lttctl_create_trace(const struct lttctl_handle *h, - char *name, enum trace_mode mode, unsigned subbuf_size, unsigned n_subbufs); + char *name, enum trace_mode mode, char *trace_type, unsigned subbuf_size, unsigned n_subbufs); int lttctl_destroy_trace(const struct lttctl_handle *handle, char *name); diff --git a/ltt-control/lttctl/lttctl.c b/ltt-control/lttctl/lttctl.c index 11483c99..bdf6f98a 100644 --- a/ltt-control/lttctl/lttctl.c +++ b/ltt-control/lttctl/lttctl.c @@ -40,6 +40,7 @@ enum trace_ctl_op { }; static char *trace_name = NULL; +static char *trace_type = "relay"; static char *mode_name = NULL; static unsigned subbuf_size = 0; static unsigned n_subbufs = 0; @@ -81,6 +82,7 @@ void show_arguments(void) printf(" (optionnaly, you can set LTT_DAEMON\n"); printf(" and the LTT_FACILITIES env. vars.)\n"); printf("-t Trace root path. (ex. /root/traces/example_trace)\n"); + printf("-T Type of trace (ex. relay)\n"); printf("-l LTT channels root path. (ex. /mnt/relayfs/ltt)\n"); printf("-z Size of the subbuffers (will be rounded to next page size)\n"); printf("-x Number of subbuffers\n"); @@ -217,6 +219,16 @@ int parse_arguments(int argc, char **argv) argn++; } break; + case 'T': + if(argn+1 < argc) { + trace_type = argv[argn+1]; + argn++; + } else { + printf("Specify a trace type after -T.\n"); + printf("\n"); + ret = EINVAL; + } + break; default: printf("Invalid argument '%s'.\n", argv[argn]); printf("\n"); @@ -390,7 +402,7 @@ int lttctl_daemon(struct lttctl_handle *handle, char *trace_name) strcat(channel_path, trace_name); - ret = lttctl_create_trace(handle, trace_name, mode, subbuf_size, n_subbufs); + ret = lttctl_create_trace(handle, trace_name, mode, trace_type, subbuf_size, n_subbufs); if(ret != 0) goto create_error; act.sa_handler = sigchld_handler; @@ -466,13 +478,13 @@ int main(int argc, char ** argv) switch(op) { case CTL_OP_CREATE_START: - ret = lttctl_create_trace(handle, trace_name, mode, subbuf_size, + ret = lttctl_create_trace(handle, trace_name, mode, trace_type, subbuf_size, n_subbufs); if(!ret) ret = lttctl_start(handle, trace_name); break; case CTL_OP_CREATE: - ret = lttctl_create_trace(handle, trace_name, mode, subbuf_size, + ret = lttctl_create_trace(handle, trace_name, mode, trace_type, subbuf_size, n_subbufs); break; case CTL_OP_DESTROY: -- 2.34.1