Elie Abi Saad | 17 Sep 12:50 2014
Picon

Live reading without using disk

Hi,

I want to make statistics on tracepoints at runtime and would like to know if
there is a way to do live reading on traces without flushing them on disk.

Live mode seems good to me, but do continuously write traces on disk, and
snapshot mode sounds perfect with the ring buffer mechanism, but we still need
to record snapshots to read traces.

Any suggestions?

Cheers,

--

-- 
Elie Abi Saad
Philippe Proulx | 15 Sep 19:43 2014
Picon

[PATCH lttng-tools] Fix: ignore error when loading optional kmod

This commit also improves the accuracy of debug messages:
a module is not "successfully" loaded when it's optional
and actually not loaded.

Fixes: #837

Signed-off-by: Philippe Proulx <eeppeliteloop <at> gmail.com>
---
 src/bin/lttng-sessiond/modprobe.c | 35 +++++++++++++++++++++++++++++------
 1 file changed, 29 insertions(+), 6 deletions(-)

diff --git a/src/bin/lttng-sessiond/modprobe.c b/src/bin/lttng-sessiond/modprobe.c
index 968b265..5c2bb05 100644
--- a/src/bin/lttng-sessiond/modprobe.c
+++ b/src/bin/lttng-sessiond/modprobe.c
 <at>  <at>  -205,8 +205,16  <at>  <at>  static int modprobe_lttng(struct kern_modules_param *modules,

 		ret = kmod_module_probe_insert_module(mod, KMOD_PROBE_IGNORE_LOADED,
 				NULL, NULL, NULL, NULL);
-		if (required && ret < 0) {
-			ERR("Unable to load module %s", modules[i].name);
+		if (ret < 0) {
+			if (required) {
+				ERR("Unable to load required module %s",
+						modules[i].name);
+				goto error;
+			} else {
+				DBG("Unable to load optional module %s; continuing",
+						modules[i].name);
+				ret = 0;
(Continue reading)

Alexander Grigoryev | 15 Sep 16:20 2014
Picon

Problem with perf:thread in 2.5.0

Hi! I use lttng-2.5.0 and linux-3.8.13. 
When I try to add context for performance counters I get the following error:
> lttng create o ; lttng add-context -u -t perf:thread:cache-references -t perf:thread:cache-misses -t perf:thread:bus-cycles -t vpid -s o ; lttng destroy -a Session o created. Traces will be written in /home/alexgri/lttng-traces/o-20140915-155906 UST context perf:thread:cache-references added to all channels Error: Context failed for channel channel0 Error: perf:thread:cache-misses: UST context already exist Error: Context failed for channel channel0 Error: perf:thread:bus-cycles: UST context already exist UST context vpid added to all channels Warning: Some command(s) went wrong Session o destroyed
If I kill lttng-sessiond:
> lttng create o ; lttng add-context -u -t perf:thread:cache-references -t perf:thread:cache-misses -t perf:thread:bus-cycles -t vpid -s o ; lttng destroy -a Spawning a session daemon PERROR - 15:59:01.250528 [13848/13856]: bind inet: Address already in use (in lttcomm_bind_inet_sock() at inet.c:109) Warning: Another session daemon is using this JUL port. JUL support will be deactivated to prevent interfering with the tracing. Session o created. Traces will be written in /home/alexgri/lttng-traces/o-20140915-155901 UST context perf:thread:cache-references added to all channels UST context perf:thread:cache-misses added to all channels UST context perf:thread:bus-cycles added to all channels UST context vpid added to all channels Session o destroyed

and run this command n times (or run program with lttng tracepoints) ....
> lttng create o ; lttng add-context -u -t perf:thread:cache-references -t perf:thread:cache-misses -t perf:thread:bus-cycles -t vpid -s o ; lttng destroy -a Session o created. Traces will be written in /home/alexgri/lttng-traces/o-20140915-155906 UST context perf:thread:cache-references added to all channels Error: Context failed for channel channel0 Error: perf:thread:cache-misses: UST context already exist Error: Context failed for channel channel0 Error: perf:thread:bus-cycles: UST context already exist UST context vpid added to all channels Warning: Some command(s) went wrong Session o destroyed

thanks, Alex
_______________________________________________
lttng-dev mailing list
lttng-dev <at> lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Thibault, Daniel | 15 Sep 15:23 2014
Picon

Re: Userspace privilege

----------------------------------------------------------------------
Date: Sat, 13 Sep 2014 05:33:29 +0800
From: Manikandan Govindaswamy <magov <at> vestas.com>

> We have a busybox version target and starting the lttng on root privilege.
>
> The kernel traces  works fine and we could get all the traces, we have application which needs root
privilege to start some part of services and also has tracepoints in it, so have to run my application from
root ( part of tracing group).
>
> When I start the another tracing from an user account who is part of tracing group, if I run the lttng list, it
opens a new session for the user?
>
> So could not possible to see the user space tracepoints which I've started from root( though it's part of
tracing group).
>
> If the user also part of tracing group then the session started by root should have been used by the user
trace list, and possible to see the tracepoints or not?
>
> GMK.
----------------------------------------------------------------------
   I'm not sure I understand your question correctly, but I'll try to answer it anyway.

   Your setup sounds right: you have lttng-sessiond running as a root service, and your tracing users are part
of the tracing group.

   Sessions are per-user objects, so one user cannot control another's sessions (unless he impersonates
that user using 'sudo -H -u <username> lttng ...').

   As long as you are a member of the tracing group, you will see all available user-space tracepoints, from all
user-spaces, even root's.  Two tracing users can create individual sessions, each of which can subscribe
to the same user-space tracepoints.  There will be discrepancies in the time-stamps of the events in
either trace, however (that is to say, the same event will register under slightly different timestamps
in either user's trace).

   If you want two users to control the same root session (necessary in order to see root's user-space
tracepoints), they need to both impersonate root.  This is done by systematically issuing 'sudo -H lttng
...' commands.

   For more details, see section 3.4 of the LTTng Comprehensive User's Guide (soon to be available; either I or
Christian Babeux can send you an advance copy if you'd like).

   If the above does not address your concerns, please explain in detail with sample session extracts.

Daniel U. Thibault
Protection des systèmes et contremesures (PSC) | Systems Protection & Countermeasures (SPC)
Cyber sécurité pour les missions essentielles (CME) | Mission Critical Cyber Security (MCCS)
RDDC - Centre de recherches de Valcartier | DRDC - Valcartier Research Centre
2459 route de la Bravoure
Québec QC  G3J 1X5
CANADA
Vox : (418) 844-4000 x4245
Fax : (418) 844-4538
NAC : 918V QSDJ <http://www.travelgis.com/map.asp?addr=918V%20QSDJ>
Gouvernement du Canada | Government of Canada
<http://www.valcartier.drdc-rddc.gc.ca/>
Philippe Proulx | 13 Sep 03:37 2014
Picon

[PATCH lttng-tools] sessiond: add --extra-kmod-probes option

This patch adds the --extra-kmod-probes option to
lttng-sessiond. The LTTNG_EXTRA_KMOD_PROBES environment
variable may also be used.

The option specifies a list of extra probe kernel modules
to be loaded (and unloaded) by lttng-sessiond. The list
is appended to either the default list or to the
user-supplied --kmod-probes list.

This option is especially useful for kernel developers who
need the default LTTng kernel probes plus additional probes
in order to instrument their custom kernel or module. This
becomes easy with --extra-kmod-probes:

    lttng-sessiond --extra-kmod-probes=custom_subsys,other

would load all known and available LTTng kernel probes plus
lttng_probe_custom_subsys and lttng_probe_other.

Signed-off-by: Philippe Proulx <eeppeliteloop <at> gmail.com>
---
 doc/man/lttng-sessiond.8          |   8 ++
 src/bin/lttng-sessiond/main.c     |  10 ++
 src/bin/lttng-sessiond/modprobe.c | 202 +++++++++++++++++++++++++++++---------
 src/bin/lttng-sessiond/modprobe.h |   1 +
 src/common/defaults.h             |   3 +
 src/common/utils.c                |  12 ++-
 src/common/utils.h                |   1 +
 7 files changed, 192 insertions(+), 45 deletions(-)

diff --git a/doc/man/lttng-sessiond.8 b/doc/man/lttng-sessiond.8
index 212b743..9cd148e 100644
--- a/doc/man/lttng-sessiond.8
+++ b/doc/man/lttng-sessiond.8
 <at>  <at>  -86,6 +86,12  <at>  <at>  Specify the kernel modules containing LTTng probes to load by the session daemon
 Only the component name of the probe needs to be specified, e.g. to load the
 lttng-probe-irq and lttng-probe-sched use: --kmod-probes="irq, sched".
 .TP
+.BR "    --extra-kmod-probes=probe1, probe2, ..."
+Specify extra kernel modules containing LTTng probes to be loaded by the session
+daemon. The list follows the format of the \fB--kmod-probes\fP option.
+This list is appended to the list provided by \fB--kmod-probes\fP or, if
+\fB--kmod-probes\fP is missing, to the default list of probes.
+.TP
 .BR "-c, --client-sock=PATH"
 Specify path for the client unix socket
 .TP
 <at>  <at>  -175,6 +181,8  <at>  <at>  the timeout of the operating system (this is the default).
 Specify the path that contains the XML session configuration schema (xsd).
 .IP "LTTNG_KMOD_PROBES"
 Specify the kernel modules probes that should be loaded by the session daemon.
+.IP "LTTNG_EXTRA_KMOD_PROBES"
+Specify extra kernel modules probes that should be loaded by the session daemon.
 .SH "SEE ALSO"

 .PP
diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
index c7fc178..2a97c37 100644
--- a/src/bin/lttng-sessiond/main.c
+++ b/src/bin/lttng-sessiond/main.c
 <at>  <at>  -157,6 +157,7  <at>  <at>  static const struct option long_options[] = {
 	{ "config", 1, 0, 'f' },
 	{ "load", 1, 0, 'l' },
 	{ "kmod-probes", 1, 0, 'P' },
+	{ "extra-kmod-probes", 1, 0, 'e' },
 	{ NULL, 0, 0, 0 }
 };

 <at>  <at>  -4214,6 +4215,7  <at>  <at>  static void usage(void)
 	fprintf(stderr, "  -f  --config                       Load daemon configuration file\n");
 	fprintf(stderr, "  -l  --load PATH                    Load session configuration\n");
 	fprintf(stderr, "      --kmod-probes                  Specify kernel module probes to load\n");
+	fprintf(stderr, "      --extra-kmod-probes            Specify extra kernel module probes to load\n");
 }

 /*
 <at>  <at>  -4400,6 +4402,14  <at>  <at>  static int set_option(int opt, const char *arg, const char *optname)
 			ret = -ENOMEM;
 		}
 		break;
+	case 'e':
+		free(kmod_extra_probes_list);
+		kmod_extra_probes_list = strdup(arg);
+		if (!kmod_extra_probes_list) {
+			perror("strdup");
+			ret = -ENOMEM;
+		}
+		break;
 	case 'f':
 		/* This is handled in set_options() thus silent break. */
 		break;
diff --git a/src/bin/lttng-sessiond/modprobe.c b/src/bin/lttng-sessiond/modprobe.c
index adad7bf..2a0b66a 100644
--- a/src/bin/lttng-sessiond/modprobe.c
+++ b/src/bin/lttng-sessiond/modprobe.c
 <at>  <at>  -95,6 +95,7  <at>  <at>  struct kern_modules_param kern_modules_probes_default[] = {
 /* dynamic probe modules list */
 static struct kern_modules_param *probes;
 static int nr_probes;
+static int probes_capacity;

 void modprobe_remove_lttng(const struct kern_modules_param *modules,
 			   int entries, int required)
 <at>  <at>  -122,8 +123,6  <at>  <at>  void modprobe_remove_lttng(const struct kern_modules_param *modules,
 			DBG("Modprobe removal successful %s",
 					modules[i].name);
 		}
-		if (probes)
-			free(probes[i].name);
 	}
 }

 <at>  <at>  -145,14 +144,18  <at>  <at>  void modprobe_remove_lttng_control(void)
  */
 void modprobe_remove_lttng_data(void)
 {
+	int i;
+
 	if (probes) {
 		modprobe_remove_lttng(probes, nr_probes, LTTNG_MOD_OPTIONAL);
+
+		for (i = 0; i < nr_probes; ++i) {
+			free(probes[i].name);
+		}
+
 		free(probes);
 		probes = NULL;
-	} else
-		modprobe_remove_lttng(kern_modules_probes_default,
-				      ARRAY_SIZE(kern_modules_probes_default),
-				      LTTNG_MOD_OPTIONAL);
+	}
 }

 /*
 <at>  <at>  -280,72 +283,183  <at>  <at>  int modprobe_lttng_control(void)
 	return ret;
 }

-/*
- * Load data kernel module(s).
+/**
+ * Grow global list of probes (double capacity or set it to 1 if
+ * currently 0 and copy existing data).
  */
-int modprobe_lttng_data(void)
+static int grow_probes(void)
 {
-	int i, ret;
-	int entries = ARRAY_SIZE(kern_modules_probes_default);
-	char *list, *next;
+	int i;

-	/*
-	 * First take command line option, if not available take environment
-	 * variable.
-	 */
-	if (kmod_probes_list) {
-		list = kmod_probes_list;
-	} else {
-		list = utils_get_kmod_probes_list();
-	}
-	/* The default is to load ALL probes */
-	if (!list) {
-		return modprobe_lttng(kern_modules_probes_default, entries,
-				LTTNG_MOD_OPTIONAL);
+	/* Initialize capacity to 1 if 0. */
+	if (probes_capacity == 0) {
+		probes = zmalloc(sizeof(*probes));
+
+		if (!probes) {
+			PERROR("malloc probe list");
+			return -ENOMEM;
+		}
+
+		probes_capacity = 1;
+
+		return 0;
 	}

-	/*
-	 * A probe list is available, so use it.
-	 * The number of probes is limited by the number of probes in the
-	 * default list.
-	 */
-	probes = zmalloc(sizeof(struct kern_modules_param *) * entries);
-	if (!probes) {
+	/* Double size. */
+	probes_capacity *= 2;
+
+	struct kern_modules_param *tmp_probes =
+		zmalloc(sizeof(*tmp_probes) * probes_capacity);
+
+	if (!tmp_probes) {
 		PERROR("malloc probe list");
 		return -ENOMEM;
 	}

-	for (i = 0; i < entries; i++) {
-		size_t name_len;
+	for (i = 0; i < nr_probes; ++i) {
+		/* Move name pointer. */
+		tmp_probes[i].name = probes[i].name;
+	}
+
+	/* Replace probes with larger copy. */
+	free(probes);
+	probes = tmp_probes;

-		next = strtok(list, ",");
+	return 0;
+}
+
+/*
+ * Appends a comma-separated list of probes to the global list
+ * of probes.
+ */
+static int append_list_to_probes(const char* list)
+{
+	char *next;
+	int ret;
+	int at = nr_probes;
+
+	char* tmp_list = strdup(list);
+
+	if (!tmp_list) {
+		PERROR("strdup temp list");
+		return -ENOMEM;
+	}
+
+	for (;;) {
+		next = strtok(tmp_list, ",");
 		if (!next) {
-			goto out;
+			break;
 		}
-		list = NULL;
+		tmp_list = NULL;

 		/* filter leading spaces */
 		while (*next == ' ') {
 			next++;
 		}

+		if (probes_capacity <= nr_probes) {
+			ret = grow_probes();
+
+			if (ret) {
+				return ret;
+			}
+		}
+
 		/* Length 13 is "lttng-probe-" + \0 */
-		name_len = strlen(next) + 13;
+		size_t name_len = strlen(next) + 13;
+
+		struct kern_modules_param *cur = &probes[at];

-		probes[i].name = zmalloc(name_len);
-		if (!probes[i].name) {
+		cur->name = zmalloc(name_len);
+		if (!cur->name) {
 			PERROR("malloc probe list");
 			return -ENOMEM;
 		}

-		ret = snprintf(probes[i].name, name_len, "lttng-probe-%s", next);
+		ret = snprintf(cur->name, name_len, "lttng-probe-%s", next);
+
 		if (ret < 0) {
 			PERROR("snprintf modprobe name");
-			goto out;
+			return -ENOMEM;
+		}
+
+		at++;
+		nr_probes++;
+	}
+
+	free(tmp_list);
+
+	return 0;
+}
+
+/*
+ * Load data kernel module(s).
+ */
+int modprobe_lttng_data(void)
+{
+	int ret, i;
+	char *list;
+
+	/*
+	 * Base probes: either from command line option, environment
+	 * variable or default list.
+	 */
+	if (kmod_probes_list) {
+		list = kmod_probes_list;
+	} else {
+		list = utils_get_kmod_probes_list();
+	}
+
+	if (list) {
+		/* User-specified probes. */
+		ret = append_list_to_probes(list);
+
+		if (ret) {
+			return ret;
+		}
+	} else {
+		/* Default probes. */
+		int def_len = ARRAY_SIZE(kern_modules_probes_default);
+		probes = zmalloc(sizeof(*probes) * def_len);
+
+		if (!probes) {
+			PERROR("malloc probe list");
+			return -ENOMEM;
+		}
+
+		nr_probes = probes_capacity = def_len;
+
+		for (i = 0; i < def_len; ++i) {
+			char* name = strdup(kern_modules_probes_default[i].name);
+
+			if (!name) {
+				PERROR("strdup probe item");
+				return -ENOMEM;
+			}
+
+			probes[i].name = name;
 		}
 	}

-out:
-	nr_probes = i;
+	/*
+	 * Extra modules? Append them to current probes list.
+	 */
+	if (kmod_extra_probes_list) {
+		list = kmod_extra_probes_list;
+	} else {
+		list = utils_get_extra_kmod_probes_list();
+	}
+
+	if (list) {
+		ret = append_list_to_probes(list);
+
+		if (ret) {
+			return ret;
+		}
+	}
+
+	/*
+	 * Load probes modules now.
+	 */
 	return modprobe_lttng(probes, nr_probes, LTTNG_MOD_OPTIONAL);
 }
diff --git a/src/bin/lttng-sessiond/modprobe.h b/src/bin/lttng-sessiond/modprobe.h
index 42e1912..cc44160 100644
--- a/src/bin/lttng-sessiond/modprobe.h
+++ b/src/bin/lttng-sessiond/modprobe.h
 <at>  <at>  -25,5 +25,6  <at>  <at>  int modprobe_lttng_control(void);
 int modprobe_lttng_data(void);

 char *kmod_probes_list;
+char *kmod_extra_probes_list;

 #endif /* _MODPROBE_H */
diff --git a/src/common/defaults.h b/src/common/defaults.h
index 88f7fe8..25d7b32 100644
--- a/src/common/defaults.h
+++ b/src/common/defaults.h
 <at>  <at>  -94,6 +94,9  <at>  <at> 
 /* Default probes list */
 #define DEFAULT_LTTNG_KMOD_PROBES		"LTTNG_KMOD_PROBES"

+/* Default extra probes list */
+#define DEFAULT_LTTNG_EXTRA_KMOD_PROBES		"LTTNG_EXTRA_KMOD_PROBES"
+
 /* Default unix socket path */
 #define DEFAULT_GLOBAL_CLIENT_UNIX_SOCK         DEFAULT_LTTNG_RUNDIR "/client-lttng-sessiond"
 #define DEFAULT_HOME_CLIENT_UNIX_SOCK           DEFAULT_LTTNG_HOME_RUNDIR "/client-lttng-sessiond"
diff --git a/src/common/utils.c b/src/common/utils.c
index ff6d1c2..1d07cb3 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
 <at>  <at>  -927,7 +927,7  <at>  <at>  end:

 /*
  * Obtain the value of LTTNG_KMOD_PROBES environment variable, if exists.
- * Otherwise returns an empty string.
+ * Otherwise returns NULL.
  */
 LTTNG_HIDDEN
 char *utils_get_kmod_probes_list(void)
 <at>  <at>  -936,6 +936,16  <at>  <at>  char *utils_get_kmod_probes_list(void)
 }

 /*
+ * Obtain the value of LTTNG_EXTRA_KMOD_PROBES environment variable, if
+ * exists. Otherwise returns NULL.
+ */
+LTTNG_HIDDEN
+char *utils_get_extra_kmod_probes_list(void)
+{
+	return getenv(DEFAULT_LTTNG_EXTRA_KMOD_PROBES);
+}
+
+/*
  * With the given format, fill dst with the time of len maximum siz.
  *
  * Return amount of bytes set in the buffer or else 0 on error.
diff --git a/src/common/utils.h b/src/common/utils.h
index bdc0e14..537fe0f 100644
--- a/src/common/utils.h
+++ b/src/common/utils.h
 <at>  <at>  -48,6 +48,7  <at>  <at>  int utils_get_count_order_u32(uint32_t x);
 char *utils_get_home_dir(void);
 char *utils_get_user_home_dir(uid_t uid);
 char *utils_get_kmod_probes_list(void);
+char *utils_get_extra_kmod_probes_list(void);
 size_t utils_get_current_time_str(const char *format, char *dst, size_t len);
 gid_t utils_get_group_id(const char *name);
 char *utils_generate_optstring(const struct option *long_options,
--

-- 
2.1.0
Philippe Proulx | 13 Sep 01:39 2014
Picon

[PATCH lttng-tools] Fix: ignore libkmod ret. value with optional kmod

This commit also improves the accuracy of debug messages:
a module is not "successfully" loaded when it's optional
and actually not loaded.

Fixes: #837

Signed-off-by: Philippe Proulx <eeppeliteloop <at> gmail.com>
---
 src/bin/lttng-sessiond/modprobe.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/bin/lttng-sessiond/modprobe.c b/src/bin/lttng-sessiond/modprobe.c
index 968b265..adad7bf 100644
--- a/src/bin/lttng-sessiond/modprobe.c
+++ b/src/bin/lttng-sessiond/modprobe.c
 <at>  <at>  -205,8 +205,14  <at>  <at>  static int modprobe_lttng(struct kern_modules_param *modules,

 		ret = kmod_module_probe_insert_module(mod, KMOD_PROBE_IGNORE_LOADED,
 				NULL, NULL, NULL, NULL);
-		if (required && ret < 0) {
-			ERR("Unable to load module %s", modules[i].name);
+		if (ret < 0) {
+			if (required) {
+				ERR("Unable to load required module %s", modules[i].name);
+				return ret;
+			} else {
+				DBG("Unable to load optional module %s; continuing", modules[i].name);
+				ret = 0;
+			}
 		} else {
 			DBG("Modprobe successfully %s", modules[i].name);
 		}
--

-- 
2.1.0
Manikandan Govindaswamy | 12 Sep 23:33 2014

Userspace privilage

Hi !

 

We have a busybox version target and starting the lttng on root privilege.

 

The kernel traces  works fine and we could get all the traces, we have application which needs root privilege to start some part of services and also has tracepoints in it, so have to run my application from root ( part of tracing group).

 

When I start the another tracing from an user account who is part of tracing group, if I run the lttng list, it opens a new session for the user?

 

So could not possible to see the user space tracepoints which I’ve started from root( though it’s part of tracing group).

 

If the user also part of tracing group then the session started by root should have been used by the user trace list, and possible to see the tracepoints or not?

 

 

Regards,

GMK.

 

 

 

 

_______________________________________________
lttng-dev mailing list
lttng-dev <at> lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Thibault, Daniel | 11 Sep 19:56 2014
Picon

lttng-bash_completion

The lttng-tools.git file extras/lttng-bash_completion is incomplete since the addition the load and
save commands to LTTng's repertoire.  The missing routines (inserted between _lttng_cmd_list() and
_lttng_cmd_setsession()) would be:

_lttng_cmd_load() {
	options=$(lttng load --list-options)

	case $cur in
	-*)
		_lttng_complete_options
		return
		;;
	*)
		_lttng_complete_sessions
		return
		;;
	esac
}

_lttng_cmd_save() {
	options=$(lttng save --list-options)

	case $cur in
	-*)
		_lttng_complete_options
		return
		;;
	*)
		_lttng_complete_sessions
		return
		;;
	esac
}

   I'll let someone else generate the patch.

   Oh, and there's a bug with those two commands.  See bug #835.

Daniel U. Thibault
Protection des systèmes et contremesures (PSC) | Systems Protection & Countermeasures (SPC)
Cyber sécurité pour les missions essentielles (CME) | Mission Critical Cyber Security (MCCS)
RDDC - Centre de recherches de Valcartier | DRDC - Valcartier Research Centre
2459 route de la Bravoure
Québec QC  G3J 1X5
CANADA
Vox : (418) 844-4000 x4245
Fax : (418) 844-4538
NAC : 918V QSDJ <http://www.travelgis.com/map.asp?addr=918V%20QSDJ>
Gouvernement du Canada | Government of Canada
<http://www.valcartier.drdc-rddc.gc.ca/>
zhenyu.ren | 11 Sep 03:38 2014

How to analysis a huge trace-collected data efficiently

Hi,
   It's well known that tracing can produce huge data easily.So if we keep tracing on a production system for a while(hour/day/week)  ,we may get  a huge CTF file. It's very inefficient to analysis a huge CTF file ,especially the interested events are in some narrow time window.Is there any way to change the situation?Can we split a huge ctf file into several small ctf file? Or can lttng produce a list of small time-sequence  ctf filles just like some loggers do?

Thanks
zhenyu.ren


_______________________________________________
lttng-dev mailing list
lttng-dev <at> lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Thibault, Daniel | 10 Sep 22:14 2014
Picon

Odd file and path in lttng-tools tarball

   In the almost-current tarball for lttng-tools (2.5.0-rc2-93, 6e7241f) (current version is
2.5.0-rc2-101, 883d80f), there is an odd file present, presumably a leftover from testing:

tests/regression/tools/save-load/ /tmp/tmp.eAJ1f0oCZE/test-42/save-42.lttng

   (Note the folder named ' ')

   Surely that does not belong?  It has been there since the 24 Mar 2014 e02b109 commit (2.4.0-rc2-184).

Daniel U. Thibault
Protection des systèmes et contremesures (PSC) | Systems Protection & Countermeasures (SPC)
Cyber sécurité pour les missions essentielles (CME) | Mission Critical Cyber Security (MCCS)
RDDC - Centre de recherches de Valcartier | DRDC - Valcartier Research Centre
2459 route de la Bravoure
Québec QC  G3J 1X5
CANADA
Vox : (418) 844-4000 x4245
Fax : (418) 844-4538
NAC : 918V QSDJ <http://www.travelgis.com/map.asp?addr=918V%20QSDJ>
Gouvernement du Canada | Government of Canada
<http://www.valcartier.drdc-rddc.gc.ca/>
David Goulet | 8 Sep 21:36 2014

Re: [PATCH] Load modules through kmod

Merged!

I've made some basic syntax fix.

Big thanks for this!

Cheers!
David

On 04 Sep (10:30:53), Umut Tezduyar Lindskog wrote:
> Instead of forking processes, load modules through libkmod.
> 
> This adds an optional package dependency to kmod but can be
> disabled by --disable-kmod option in ./configure. If
> --enable-kmod option is given but no kmod is found, loading
> will happen by forking a process.
> 
> The startup time has decreased by %36 on our embedded mips
> product. The measurement is done by cgroup cpu shares.
> ---
>  configure.ac                      |   34 ++++++++++++++++++++++++
>  src/bin/lttng-sessiond/modprobe.c |   53 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 87 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index a8e04f5..fb0b03f 100644
> --- a/configure.ac
> +++ b/configure.ac
>  <at>  <at>  -200,6 +200,32  <at>  <at>  AC_CHECK_DECL([cmm_smp_mb__before_uatomic_or], [],
>          [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
>  )
>  
> +# Check kmod library
> +AC_ARG_WITH(kmod-prefix,
> +  AS_HELP_STRING([--with-kmod-prefix=PATH],
> +                 [Specify the installation prefix of the kmod library.
> +	          Headers must be in PATH/include; libraries in PATH/lib.]),
> +		  [
> +		    CPPFLAGS="$CPPFLAGS -I${withval}/include"
> +		    LDFLAGS="$LDFLAGS -L${withval}/lib64 -L${withval}/lib"
> +		  ])
> +
> +AC_ARG_ENABLE(kmod,
> +	AS_HELP_STRING([--disable-kmod],[build without kmod support]),
> +	kmod_support=$enableval, kmod_support=yes)
> +
> +AS_IF([test "x$kmod_support" = "xyes"], [
> +	AC_CHECK_LIB([kmod], [kmod_module_probe_insert_module],
> +		[
> +			AC_DEFINE([HAVE_KMOD], [1], [has kmod support])
> +			LIBS="$LIBS -lkmod"
> +			kmod_found=yes
> +		],
> +		kmod_found=no
> +	)
> +])
> +AM_CONDITIONAL([HAVE_KMOD], [test "x$kmod_found" = xyes])
> +
>  AC_ARG_WITH(lttng-ust-prefix,
>    AS_HELP_STRING([--with-lttng-ust-prefix=PATH],
>                   [Specify the installation prefix of the lttng-ust library.
>  <at>  <at>  -483,6 +509,14  <at>  <at>  done
>  AS_ECHO_N("Target architecture: ")
>  AS_ECHO($target_arch)
>  
> +# kmod enabled/disabled
> +AS_ECHO_N("kmod support: ")
> +AS_IF([test "x$kmod_found" = "xyes"],[
> +	AS_ECHO("Enabled")
> +],[
> +	AS_ECHO("Disabled")
> +])
> +
>  # LTTng-UST enabled/disabled
>  AS_ECHO_N("Lttng-UST support: ")
>  AS_IF([test "x$lttng_ust_support" = "xyes"],[
> diff --git a/src/bin/lttng-sessiond/modprobe.c b/src/bin/lttng-sessiond/modprobe.c
> index 3cc67f0..40a2ee0 100644
> --- a/src/bin/lttng-sessiond/modprobe.c
> +++ b/src/bin/lttng-sessiond/modprobe.c
>  <at>  <at>  -164,6 +164,58  <at>  <at>  void modprobe_remove_lttng_all(void)
>  	modprobe_remove_lttng_control();
>  }
>  
> +#if HAVE_KMOD
> +#include <libkmod.h>
> +static void log_kmod(void *data, int priority, const char *file, int line,
> +		     const char *fn, const char *format, va_list args)
> +{
> +	char *str;
> +	if (vasprintf(&str, format, args) < 0)
> +		return;
> +	DBG("libkmod: %s", str);
> +	free(str);
> +}
> +static int modprobe_lttng(struct kern_modules_param *modules,
> +			  int entries, int required)
> +{
> +	int ret = 0, i;
> +	struct kmod_ctx *ctx;
> +
> +	ctx = kmod_new(NULL, NULL);
> +	if (!ctx) {
> +		PERROR("Unable to create kmod library context");
> +		ret = -ENOMEM;
> +		goto error;
> +	}
> +
> +	kmod_set_log_fn(ctx, log_kmod, NULL);
> +	kmod_load_resources(ctx);
> +
> +	for (i = 0; i < entries; i++) {
> +		struct kmod_module *mod = NULL;
> +
> +		ret = kmod_module_new_from_name(ctx, modules[i].name, &mod);
> +		if (ret < 0) {
> +			PERROR("Failed to create kmod module for %s", modules[i].name);
> +			goto error;
> +		}
> +
> +		ret = kmod_module_probe_insert_module(mod, KMOD_PROBE_IGNORE_LOADED, NULL, NULL, NULL, NULL);
> +		if (required && ret < 0) {
> +			ERR("Unable to load module %s", modules[i].name);
> +		} else {
> +			DBG("Modprobe successfully %s", modules[i].name);
> +		}
> +
> +		kmod_module_unref(mod);
> +	}
> +
> +error:
> +	if (ctx)
> +		kmod_unref(ctx);
> +	return ret;
> +}
> +#else
>  static int modprobe_lttng(struct kern_modules_param *modules,
>  			  int entries, int required)
>  {
>  <at>  <at>  -194,6 +246,7  <at>  <at>  static int modprobe_lttng(struct kern_modules_param *modules,
>  error:
>  	return ret;
>  }
> +#endif
>  
>  /*
>   * Load control kernel module(s).
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev <at> lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
_______________________________________________
lttng-dev mailing list
lttng-dev <at> lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Gmane