libltt : size + n subbufs + align options
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 30 Jul 2005 00:10:28 +0000 (00:10 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 30 Jul 2005 00:10:28 +0000 (00:10 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@990 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/libltt/libltt.c
ltt/branches/poly/libltt/libltt.h

index 5363f843f33eb3c75cb3df8fffac603b7f95a019..72eabd70eb657cc11629b3bd7442305d6b98293c 100644 (file)
@@ -292,7 +292,7 @@ int lttctl_destroy_handle(struct lttctl_handle *h)
 
 
 int lttctl_create_trace(const struct lttctl_handle *h,
-               char *name, enum trace_mode mode)
+               char *name, enum trace_mode mode, unsigned subbuf_size, unsigned n_subbufs)
 {
        int err;
        
@@ -315,7 +315,9 @@ int lttctl_create_trace(const struct lttctl_handle *h,
 
        strncpy(req.msg.trace_name, name, NAME_MAX);
        req.msg.op = OP_CREATE;
-       req.msg.args.mode = mode;
+       req.msg.args.new_trace.mode = mode;
+       req.msg.args.new_trace.subbuf_size = subbuf_size;
+       req.msg.args.new_trace.n_subbufs = n_subbufs;
 
        err = lttctl_netlink_sendto(h, (void *)&req, req.nlh.nlmsg_len);
        if(err < 0) goto senderr;
@@ -468,3 +470,48 @@ senderr:
        lttctl_perror("Stop Trace Error");
        return err;
 }
+
+
+int lttctl_align(const struct lttctl_handle *h,
+               char *name, unsigned alignment)
+{
+       struct {
+               struct nlmsghdr nlh;
+               lttctl_peer_msg_t       msg;
+       } req;
+       struct {
+               struct nlmsghdr nlh;
+               struct nlmsgerr nlerr;
+               lttctl_peer_msg_t       msg;
+       } ack;
+       int err;
+
+       memset(&req, 0, sizeof(req));
+       req.nlh.nlmsg_len = NLMSG_LENGTH(sizeof(lttctl_peer_msg_t));
+       req.nlh.nlmsg_flags = NLM_F_REQUEST;
+       req.nlh.nlmsg_type = LTTCTLM_CONTROL;
+       req.nlh.nlmsg_pid = h->local.nl_pid;
+
+       strncpy(req.msg.trace_name, name, NAME_MAX);
+       req.msg.op = OP_ALIGN;
+       req.msg.args.alignment = alignment;
+
+       err = lttctl_netlink_sendto(h, (void *)&req, req.nlh.nlmsg_len);
+       if(err < 0) goto senderr;
+
+       err = lttctl_netlink_recvfrom(h, (void*)&ack, sizeof(ack), 0);
+       if(err < 0) goto senderr;
+
+       err = ack.nlerr.error;
+       if(err != 0) {
+               errno = err;
+               lttctl_perror("Align Trace Error");
+               return -1;
+       }
+
+       return 0;
+
+senderr:
+       lttctl_perror("Align Trace Error");
+       return err;
+}
index 68281a2c1db2f4c41b010229c3c059fcb4a30148..06a40f244cbe3115e3c74192e125666103ec601b 100644 (file)
@@ -37,6 +37,7 @@ enum trace_op {
        OP_DESTROY,
        OP_START,
        OP_STOP,
+       OP_ALIGN,
        OP_NONE
 };
 
@@ -45,6 +46,19 @@ enum trace_mode {
        LTT_TRACE_FLIGHT
 };
 
+typedef struct lttctl_peer_msg {
+       char trace_name[NAME_MAX];
+       enum trace_op op;
+       union {
+    struct {
+      enum trace_mode mode;
+      unsigned subbuf_size;
+      unsigned n_subbufs;
+    } new_trace;
+    unsigned alignment;
+       } args;
+} lttctl_peer_msg_t;
+
 
 struct lttctl_handle
 {
@@ -54,14 +68,6 @@ struct lttctl_handle
   struct sockaddr_nl peer;
 };
 
-typedef struct lttctl_peer_msg {
-       char trace_name[NAME_MAX];
-       enum trace_op op;
-       union {
-               enum trace_mode mode;
-       } args;
-} lttctl_peer_msg_t;
-
 typedef struct lttctl_resp_msg {
        int err;
 } lttctl_resp_msg_t;
@@ -71,8 +77,8 @@ struct lttctl_handle *lttctl_create_handle(void);
 int lttctl_destroy_handle(struct lttctl_handle *h);
 
 
-int lttctl_create_trace(const struct lttctl_handle * handle,
-               char *name, enum trace_mode mode);
+int lttctl_create_trace(const struct lttctl_handle *h,
+               char *name, enum trace_mode mode, unsigned subbuf_size, unsigned n_subbufs);
 
 int lttctl_destroy_trace(const struct lttctl_handle *handle, char *name);
 
This page took 0.025361 seconds and 4 git commands to generate.