Linux-Trace-Devel Archive on lore.kernel.org
 help / Atom feed
* [PATCH 0/7] trace-cmd [POC]: Timestamps sync using PTP-like algorithm, relying on vsock events.
@ 2019-01-16 19:18 Tzvetomir Stoyanov
  2019-01-16 19:18 ` [PATCH 1/7] trace-cmd: Implemented new lib API: tracecmd_local_events_system() Tzvetomir Stoyanov
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Tzvetomir Stoyanov @ 2019-01-16 19:18 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

This patch series is a POC for timestamps sync between guest and host machines. 
It implelents PTP-like algorithm, using vsock events for getting the current time. 
Best results are achieved when "boot" clock is used on both host and guest when
recording the events.
The patch series depends on Slavomir's changes, introduced by the patch series
"Add VM kernel tracing over vsock sockets"

Tzvetomir Stoyanov (7):
  trace-cmd: Implemented new lib API: tracecmd_local_events_system()
  trace-cmd: Added new option in trace.dat file for negative time
    offsets
  trace-cmd: Fixed logic in tracecmd_read_page_record()
  trace-cmd: Added implementation of htonll() and ntohll()
  trace-cmd: Added user configured clock to the record context
  trace-cmd: Refactored make_instances() and tracecmd_remove_instances()
  trace-cmd [POC]: Implemented timestamps synch PTP-like algorithm,
    using vsock events.

 include/trace-cmd/trace-cmd.h  |   7 +
 lib/trace-cmd/trace-input.c    |  19 +-
 lib/trace-cmd/trace-util.c     |  89 +++++---
 tracecmd/include/trace-local.h |   5 +
 tracecmd/include/trace-msg.h   |  10 +
 tracecmd/trace-listen.c        |   3 +
 tracecmd/trace-msg.c           | 311 ++++++++++++++++++++++++++-
 tracecmd/trace-record.c        | 380 +++++++++++++++++++++++++--------
 8 files changed, 685 insertions(+), 139 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/7] trace-cmd: Implemented new lib API: tracecmd_local_events_system()
  2019-01-16 19:18 [PATCH 0/7] trace-cmd [POC]: Timestamps sync using PTP-like algorithm, relying on vsock events Tzvetomir Stoyanov
@ 2019-01-16 19:18 ` Tzvetomir Stoyanov
  2019-01-21  9:02   ` Steven Rostedt
  2019-01-16 19:18 ` [PATCH 2/7] trace-cmd: Added new option in trace.dat file for negative time offsets Tzvetomir Stoyanov
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Tzvetomir Stoyanov @ 2019-01-16 19:18 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

The new tracecmd lib API tracecmd_local_events_system() creates
a tep handler and initializes it with the events of the
specified subsystem.

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
---
 include/trace-cmd/trace-cmd.h |  2 +
 lib/trace-cmd/trace-util.c    | 89 ++++++++++++++++++++++-------------
 2 files changed, 59 insertions(+), 32 deletions(-)

diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h
index 238e16b..c79fc63 100644
--- a/include/trace-cmd/trace-cmd.h
+++ b/include/trace-cmd/trace-cmd.h
@@ -32,6 +32,8 @@ void tracecmd_unload_plugins(struct tep_plugin_list *list, struct tep_handle *pe
 char **tracecmd_event_systems(const char *tracing_dir);
 char **tracecmd_system_events(const char *tracing_dir, const char *system);
 struct tep_handle *tracecmd_local_events(const char *tracing_dir);
+struct tep_handle *tracecmd_local_events_system(const char *tracing_dir,
+						char *sys_name);
 int tracecmd_fill_local_events(const char *tracing_dir, struct tep_handle *pevent);
 char **tracecmd_local_plugins(const char *tracing_dir);
 
diff --git a/lib/trace-cmd/trace-util.c b/lib/trace-cmd/trace-util.c
index b5aea39..706aab3 100644
--- a/lib/trace-cmd/trace-util.c
+++ b/lib/trace-cmd/trace-util.c
@@ -1119,37 +1119,9 @@ static int read_header(struct tep_handle *pevent, const char *events_dir)
 	return ret;
 }
 
-/**
- * tracecmd_local_events - create a pevent from the events on system
- * @tracing_dir: The directory that contains the events.
- *
- * Returns a pevent structure that contains the pevents local to
- * the system.
- */
-struct tep_handle *tracecmd_local_events(const char *tracing_dir)
-{
-	struct tep_handle *pevent = NULL;
-
-	pevent = tep_alloc();
-	if (!pevent)
-		return NULL;
-
-	if (tracecmd_fill_local_events(tracing_dir, pevent)) {
-		tep_free(pevent);
-		pevent = NULL;
-	}
-
-	return pevent;
-}
-
-/**
- * tracecmd_fill_local_events - Fill a pevent with the events on system
- * @tracing_dir: The directory that contains the events.
- * @pevent: Allocated pevent which will be filled
- *
- * Returns whether the operation succeeded
- */
-int tracecmd_fill_local_events(const char *tracing_dir, struct tep_handle *pevent)
+static int tracecmd_fill_local_events_system(const char *tracing_dir,
+					     struct tep_handle *pevent,
+					     char *sys_name)
 {
 	struct dirent *dent;
 	char *events_dir;
@@ -1189,7 +1161,8 @@ int tracecmd_fill_local_events(const char *tracing_dir, struct tep_handle *peven
 		if (strcmp(name, ".") == 0 ||
 		    strcmp(name, "..") == 0)
 			continue;
-
+		if (sys_name && strcmp(name, sys_name))
+			continue;
 		sys = append_file(events_dir, name);
 		ret = stat(sys, &st);
 		if (ret < 0 || !S_ISDIR(st.st_mode)) {
@@ -1217,6 +1190,58 @@ int tracecmd_fill_local_events(const char *tracing_dir, struct tep_handle *peven
 	return ret;
 }
 
+/**
+ * tracecmd_local_events_system - create a tep from the
+ * events of the specified subsystem.
+ *
+ * @tracing_dir: The directory that contains the events.
+ * @sys_name: Name of the subsystem, to load events from
+ *
+ * Returns a tep structure that contains the tep local to
+ * the system.
+ */
+struct tep_handle *tracecmd_local_events_system(const char *tracing_dir,
+						char *sys_name)
+{
+	struct tep_handle *tep = NULL;
+
+	tep = tep_alloc();
+	if (!tep)
+		return NULL;
+
+	if (tracecmd_fill_local_events_system(tracing_dir, tep, sys_name)) {
+		tep_free(tep);
+		tep = NULL;
+	}
+
+	return tep;
+}
+
+/**
+ * tracecmd_local_events - create a pevent from the events on system
+ * @tracing_dir: The directory that contains the events.
+ *
+ * Returns a pevent structure that contains the pevents local to
+ * the system.
+ */
+struct tep_handle *tracecmd_local_events(const char *tracing_dir)
+{
+	return tracecmd_local_events_system(tracing_dir, NULL);
+}
+
+/**
+ * tracecmd_fill_local_events - Fill a pevent with the events on system
+ * @tracing_dir: The directory that contains the events.
+ * @pevent: Allocated pevent which will be filled
+ *
+ * Returns whether the operation succeeded
+ */
+int tracecmd_fill_local_events(const char *tracing_dir,
+			       struct tep_handle *pevent)
+{
+	return tracecmd_fill_local_events_system(tracing_dir, pevent, NULL);
+}
+
 /**
  * tracecmd_local_plugins - returns an array of available tracer plugins
  * @tracing_dir: The directory that contains the tracing directory
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 2/7] trace-cmd: Added new option in trace.dat file for negative time offsets
  2019-01-16 19:18 [PATCH 0/7] trace-cmd [POC]: Timestamps sync using PTP-like algorithm, relying on vsock events Tzvetomir Stoyanov
  2019-01-16 19:18 ` [PATCH 1/7] trace-cmd: Implemented new lib API: tracecmd_local_events_system() Tzvetomir Stoyanov
@ 2019-01-16 19:18 ` Tzvetomir Stoyanov
  2019-01-21  9:08   ` Steven Rostedt
  2019-01-16 19:18 ` [PATCH 3/7] trace-cmd: Fixed logic in tracecmd_read_page_record() Tzvetomir Stoyanov
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Tzvetomir Stoyanov @ 2019-01-16 19:18 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

When synchronizing timestamps between different machines, there are cases
when the time offset is negative. A new option, TRACECMD_OPTION_OFFSET_N,
is added in trace.dat file for such use cases. The format is the same as
TRACECMD_OPTION_OFFSET, but the value is interpreted as negative integer.

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
---
 include/trace-cmd/trace-cmd.h |   1 +
 lib/trace-cmd/trace-input.c   |   7 +-
 tracecmd/trace-record.c       | 123 +++++++++++++++++-----------------
 3 files changed, 70 insertions(+), 61 deletions(-)

diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h
index c79fc63..d0bddfc 100644
--- a/include/trace-cmd/trace-cmd.h
+++ b/include/trace-cmd/trace-cmd.h
@@ -82,6 +82,7 @@ enum {
 	TRACECMD_OPTION_HOOK,
 	TRACECMD_OPTION_OFFSET,
 	TRACECMD_OPTION_CPUCOUNT,
+	TRACECMD_OPTION_OFFSET_N,
 };
 
 enum {
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index b628570..de15d4b 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -2151,6 +2151,7 @@ static int handle_options(struct tracecmd_input *handle)
 			handle->ts_offset += offset;
 			break;
 		case TRACECMD_OPTION_OFFSET:
+		case TRACECMD_OPTION_OFFSET_N:
 			/*
 			 * Similar to date option, but just adds an
 			 * offset to the timestamp.
@@ -2158,7 +2159,11 @@ static int handle_options(struct tracecmd_input *handle)
 			if (handle->flags & TRACECMD_FL_IGNORE_DATE)
 				break;
 			offset = strtoll(buf, NULL, 0);
-			handle->ts_offset += offset;
+			if (option == TRACECMD_OPTION_OFFSET_N) {
+				if (handle->ts_offset > offset)
+					handle->ts_offset -= offset;
+			} else
+				handle->ts_offset += offset;
 			break;
 		case TRACECMD_OPTION_CPUSTAT:
 			buf[size-1] = '\n';
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index cd80462..f7349eb 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -201,6 +201,13 @@ enum trace_cmd {
 	CMD_record_agent,
 };
 
+enum {
+	DATA_FL_NONE		= 0,
+	DATA_FL_DATE		= 1,
+	DATA_FL_OFFSET		= 2,
+	DATA_FL_OFFSET_N	= 4,
+};
+
 struct common_record_context {
 	enum trace_cmd curr_cmd;
 	struct buffer_instance *instance;
@@ -3230,7 +3237,62 @@ again:
 	return msg_handle;
 }
 
-static void add_options(struct tracecmd_output *handle, struct common_record_context *ctx);
+static void add_option_hooks(struct tracecmd_output *handle)
+{
+	struct hook_list *hook;
+	int len;
+
+	for (hook = hooks; hook; hook = hook->next) {
+		len = strlen(hook->hook);
+		tracecmd_add_option(handle, TRACECMD_OPTION_HOOK,
+				    len + 1, hook->hook);
+	}
+}
+
+static void add_uname(struct tracecmd_output *handle)
+{
+	struct utsname buf;
+	char *str;
+	int len;
+	int ret;
+
+	ret = uname(&buf);
+	/* if this fails for some reason, just ignore it */
+	if (ret < 0)
+		return;
+
+	len = strlen(buf.sysname) + strlen(buf.nodename) +
+		strlen(buf.release) + strlen(buf.machine) + 4;
+	str = malloc(len);
+	if (!str)
+		return;
+	sprintf(str, "%s %s %s %s", buf.sysname, buf.nodename, buf.release, buf.machine);
+	tracecmd_add_option(handle, TRACECMD_OPTION_UNAME, len, str);
+	free(str);
+}
+
+static void add_options(struct tracecmd_output *handle,
+			struct common_record_context *ctx)
+{
+	int type = 0;
+
+	if (ctx->date2ts) {
+		if (ctx->data_flags & DATA_FL_DATE)
+			type = TRACECMD_OPTION_DATE;
+		else if (ctx->data_flags & DATA_FL_OFFSET)
+			type = TRACECMD_OPTION_OFFSET;
+		else if (ctx->data_flags & DATA_FL_OFFSET_N)
+			type = TRACECMD_OPTION_OFFSET_N;
+	}
+
+	if (type)
+		tracecmd_add_option(handle, type,
+				    strlen(ctx->date2ts)+1, ctx->date2ts);
+
+	tracecmd_add_option(handle, TRACECMD_OPTION_TRACECLOCK, 0, NULL);
+	add_option_hooks(handle);
+	add_uname(handle);
+}
 
 static struct tracecmd_msg_handle *
 setup_connection(struct buffer_instance *instance, struct common_record_context *ctx)
@@ -3457,40 +3519,6 @@ add_buffer_stat(struct tracecmd_output *handle, struct buffer_instance *instance
 				    instance->s_save[i].buffer);
 }
 
-static void add_option_hooks(struct tracecmd_output *handle)
-{
-	struct hook_list *hook;
-	int len;
-
-	for (hook = hooks; hook; hook = hook->next) {
-		len = strlen(hook->hook);
-		tracecmd_add_option(handle, TRACECMD_OPTION_HOOK,
-				    len + 1, hook->hook);
-	}
-}
-
-static void add_uname(struct tracecmd_output *handle)
-{
-	struct utsname buf;
-	char *str;
-	int len;
-	int ret;
-
-	ret = uname(&buf);
-	/* if this fails for some reason, just ignore it */
-	if (ret < 0)
-		return;
-
-	len = strlen(buf.sysname) + strlen(buf.nodename) +
-		strlen(buf.release) + strlen(buf.machine) + 4;
-	str = malloc(len);
-	if (!str)
-		return;
-	sprintf(str, "%s %s %s %s", buf.sysname, buf.nodename, buf.release, buf.machine);
-	tracecmd_add_option(handle, TRACECMD_OPTION_UNAME, len, str);
-	free(str);
-}
-
 static void print_stat(struct buffer_instance *instance)
 {
 	int cpu;
@@ -3505,31 +3533,6 @@ static void print_stat(struct buffer_instance *instance)
 		trace_seq_do_printf(&instance->s_print[cpu]);
 }
 
-enum {
-	DATA_FL_NONE		= 0,
-	DATA_FL_DATE		= 1,
-	DATA_FL_OFFSET		= 2,
-};
-
-static void add_options(struct tracecmd_output *handle, struct common_record_context *ctx)
-{
-	int type = 0;
-
-	if (ctx->date2ts) {
-		if (ctx->data_flags & DATA_FL_DATE)
-			type = TRACECMD_OPTION_DATE;
-		else if (ctx->data_flags & DATA_FL_OFFSET)
-			type = TRACECMD_OPTION_OFFSET;
-	}
-
-	if (type)
-		tracecmd_add_option(handle, type, strlen(ctx->date2ts)+1, ctx->date2ts);
-
-	tracecmd_add_option(handle, TRACECMD_OPTION_TRACECLOCK, 0, NULL);
-	add_option_hooks(handle);
-	add_uname(handle);
-}
-
 static void write_guest_file(struct buffer_instance *instance)
 {
 	struct tracecmd_output *handle;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 3/7] trace-cmd: Fixed logic in tracecmd_read_page_record()
  2019-01-16 19:18 [PATCH 0/7] trace-cmd [POC]: Timestamps sync using PTP-like algorithm, relying on vsock events Tzvetomir Stoyanov
  2019-01-16 19:18 ` [PATCH 1/7] trace-cmd: Implemented new lib API: tracecmd_local_events_system() Tzvetomir Stoyanov
  2019-01-16 19:18 ` [PATCH 2/7] trace-cmd: Added new option in trace.dat file for negative time offsets Tzvetomir Stoyanov
@ 2019-01-16 19:18 ` Tzvetomir Stoyanov
  2019-01-21  9:09   ` Steven Rostedt
  2019-01-16 19:18 ` [PATCH 4/7] trace-cmd: Added implementation of htonll() and ntohll() Tzvetomir Stoyanov
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Tzvetomir Stoyanov @ 2019-01-16 19:18 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

Fixed the logic in tracecmd_read_page_record() when
searching for the next event in the event from the
ring buffer.

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
---
 lib/trace-cmd/trace-input.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index de15d4b..c2b993a 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -1688,18 +1688,22 @@ tracecmd_read_page_record(struct tep_handle *pevent, void *page, int size,
 			goto out_free;
 		}
 
-		do {
+		ptr = kbuffer_read_event(kbuf, &ts);
+		while (ptr < last_record->data) {
 			ptr = kbuffer_next_event(kbuf, NULL);
 			if (!ptr)
 				break;
-		} while (ptr < last_record->data);
+			if (ptr == last_record->data)
+				break;
+		}
 		if (ptr != last_record->data) {
 			warning("tracecmd_read_page_record: could not find last_record");
 			goto out_free;
 		}
-	}
+		ptr = kbuffer_next_event(kbuf, &ts);
+	} else
+		ptr = kbuffer_read_event(kbuf, &ts);
 
-	ptr = kbuffer_read_event(kbuf, &ts);
 	if (!ptr)
 		goto out_free;
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 4/7] trace-cmd: Added implementation of htonll() and ntohll()
  2019-01-16 19:18 [PATCH 0/7] trace-cmd [POC]: Timestamps sync using PTP-like algorithm, relying on vsock events Tzvetomir Stoyanov
                   ` (2 preceding siblings ...)
  2019-01-16 19:18 ` [PATCH 3/7] trace-cmd: Fixed logic in tracecmd_read_page_record() Tzvetomir Stoyanov
@ 2019-01-16 19:18 ` Tzvetomir Stoyanov
  2019-01-16 19:18 ` [PATCH 5/7] trace-cmd: Added user configured clock to the record context Tzvetomir Stoyanov
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Tzvetomir Stoyanov @ 2019-01-16 19:18 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

Added implementation of htonll() and ntohll() as
macros, if they are not already defined.

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
---
 tracecmd/include/trace-msg.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tracecmd/include/trace-msg.h b/tracecmd/include/trace-msg.h
index b7fe10b..445f799 100644
--- a/tracecmd/include/trace-msg.h
+++ b/tracecmd/include/trace-msg.h
@@ -15,4 +15,14 @@ extern unsigned int page_size;
 void plog(const char *fmt, ...);
 void pdie(const char *fmt, ...);
 
+#ifndef htonll
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+#define htonll(x) __bswap_64(x)
+#define ntohll(x) __bswap_64(x)
+#else
+#define htonll(x) (x)
+#define ntohll(x) (x)
+#endif
+#endif
+
 #endif /* _TRACE_MSG_H_ */
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 5/7] trace-cmd: Added user configured clock to the record context
  2019-01-16 19:18 [PATCH 0/7] trace-cmd [POC]: Timestamps sync using PTP-like algorithm, relying on vsock events Tzvetomir Stoyanov
                   ` (3 preceding siblings ...)
  2019-01-16 19:18 ` [PATCH 4/7] trace-cmd: Added implementation of htonll() and ntohll() Tzvetomir Stoyanov
@ 2019-01-16 19:18 ` Tzvetomir Stoyanov
  2019-01-21  9:19   ` Steven Rostedt
  2019-01-16 19:18 ` [PATCH 6/7] trace-cmd: Refactored make_instances() and tracecmd_remove_instances() Tzvetomir Stoyanov
  2019-01-16 19:18 ` [PATCH 7/7] trace-cmd [POC]: Implemented timestamps synch PTP-like algorithm, using vsock events Tzvetomir Stoyanov
  6 siblings, 1 reply; 17+ messages in thread
From: Tzvetomir Stoyanov @ 2019-01-16 19:18 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

Store the user configured clock (if any) in the record context,
struct common_record_context. The clock is going to be used when
synchronizing timestamps with remote tracing machine.
---
 tracecmd/trace-record.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index f7349eb..900d0d4 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -227,6 +227,7 @@ struct common_record_context {
 	int topt;
 	int do_child;
 	int run_command;
+	char *clock;
 };
 
 static void add_reset_file(const char *file, const char *val, int prio)
@@ -5183,6 +5184,7 @@ static void parse_record_options(int argc,
 			break;
 		case 'C':
 			ctx->instance->clock = optarg;
+			ctx->clock = optarg;
 			break;
 		case 'v':
 			neg_event = 1;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 6/7] trace-cmd: Refactored make_instances() and tracecmd_remove_instances()
  2019-01-16 19:18 [PATCH 0/7] trace-cmd [POC]: Timestamps sync using PTP-like algorithm, relying on vsock events Tzvetomir Stoyanov
                   ` (4 preceding siblings ...)
  2019-01-16 19:18 ` [PATCH 5/7] trace-cmd: Added user configured clock to the record context Tzvetomir Stoyanov
@ 2019-01-16 19:18 ` Tzvetomir Stoyanov
  2019-01-21  9:13   ` Steven Rostedt
  2019-01-16 19:18 ` [PATCH 7/7] trace-cmd [POC]: Implemented timestamps synch PTP-like algorithm, using vsock events Tzvetomir Stoyanov
  6 siblings, 1 reply; 17+ messages in thread
From: Tzvetomir Stoyanov @ 2019-01-16 19:18 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

In order to reuse the code which creates / deletes tracing instances,
these two functions are refactotred. A new ones are implemented:
make_one_instances() and tracecmd_remove_one_instance().

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
---
 tracecmd/trace-record.c | 54 +++++++++++++++++++++++------------------
 1 file changed, 31 insertions(+), 23 deletions(-)

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 900d0d4..4c3df3d 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -4260,49 +4260,57 @@ static void clear_func_filters(void)
 	}
 }
 
-static void make_instances(void)
+static void make_one_instances(struct buffer_instance *instance)
 {
-	struct buffer_instance *instance;
 	struct stat st;
 	char *path;
 	int ret;
 
+	path = get_instance_dir(instance);
+	ret = stat(path, &st);
+	if (ret < 0) {
+		ret = mkdir(path, 0777);
+		if (ret < 0)
+			die("mkdir %s", path);
+	} else
+		/* Don't delete instances that already exist */
+		instance->flags |= BUFFER_FL_KEEP;
+	tracecmd_put_tracing_file(path);
+
+}
+
+static void make_instances(void)
+{
+	struct buffer_instance *instance;
+
 	for_each_instance(instance) {
 		if (instance->flags & BUFFER_FL_GUEST)
 			continue;
+		make_one_instances(instance);
+	}
+}
 
-		path = get_instance_dir(instance);
-		ret = stat(path, &st);
-		if (ret < 0) {
-			ret = mkdir(path, 0777);
-			if (ret < 0)
-				die("mkdir %s", path);
-		} else
-			/* Don't delete instances that already exist */
-			instance->flags |= BUFFER_FL_KEEP;
-		tracecmd_put_tracing_file(path);
+static void tracecmd_remove_one_instance(struct buffer_instance *instance)
+{
+	char *path;
+
+	if (instance->tracing_on_fd > 0) {
+		close(instance->tracing_on_fd);
+		instance->tracing_on_fd = 0;
 	}
+	path = get_instance_dir(instance);
+	tracecmd_put_tracing_file(path);
 }
 
 void tracecmd_remove_instances(void)
 {
 	struct buffer_instance *instance;
-	char *path;
-	int ret;
 
 	for_each_instance(instance) {
 		/* Only delete what we created */
 		if (instance->flags & (BUFFER_FL_KEEP | BUFFER_FL_GUEST))
 			continue;
-		if (instance->tracing_on_fd > 0) {
-			close(instance->tracing_on_fd);
-			instance->tracing_on_fd = 0;
-		}
-		path = get_instance_dir(instance);
-		ret = rmdir(path);
-		if (ret < 0)
-			die("rmdir %s", path);
-		tracecmd_put_tracing_file(path);
+		tracecmd_remove_one_instance(instance);
 	}
 }
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 7/7] trace-cmd [POC]: Implemented timestamps synch PTP-like algorithm, using vsock events.
  2019-01-16 19:18 [PATCH 0/7] trace-cmd [POC]: Timestamps sync using PTP-like algorithm, relying on vsock events Tzvetomir Stoyanov
                   ` (5 preceding siblings ...)
  2019-01-16 19:18 ` [PATCH 6/7] trace-cmd: Refactored make_instances() and tracecmd_remove_instances() Tzvetomir Stoyanov
@ 2019-01-16 19:18 ` Tzvetomir Stoyanov
  6 siblings, 0 replies; 17+ messages in thread
From: Tzvetomir Stoyanov @ 2019-01-16 19:18 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

This is a POC patch, implementing a PTP-like algorithm for syncing timestamps between
host and guest machines, using vsock trace events to catch the host / guest time.
---
 include/trace-cmd/trace-cmd.h  |   4 +
 tracecmd/include/trace-local.h |   5 +
 tracecmd/trace-listen.c        |   3 +
 tracecmd/trace-msg.c           | 311 +++++++++++++++++++++++++++++++--
 tracecmd/trace-record.c        | 201 ++++++++++++++++++++-
 5 files changed, 505 insertions(+), 19 deletions(-)

diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h
index d0bddfc..8fb5ee9 100644
--- a/include/trace-cmd/trace-cmd.h
+++ b/include/trace-cmd/trace-cmd.h
@@ -352,6 +352,10 @@ int tracecmd_msg_recv_trace_resp(struct tracecmd_msg_handle *msg_handle,
 				 int *nr_cpus, int *page_size,
 				 unsigned int **ports);
 
+int tracecmd_msg_rcv_time_sync(struct tracecmd_msg_handle *msg_handle);
+int tracecmd_msg_snd_time_sync(struct tracecmd_msg_handle *msg_handle,
+			       char *clock_str, long long *toffset);
+
 int tracecmd_msg_wait_close(struct tracecmd_msg_handle *msg_handle);
 
 /* --- Plugin handling --- */
diff --git a/tracecmd/include/trace-local.h b/tracecmd/include/trace-local.h
index 823d323..c502c70 100644
--- a/tracecmd/include/trace-local.h
+++ b/tracecmd/include/trace-local.h
@@ -225,6 +225,11 @@ void show_instance_file(struct buffer_instance *instance, const char *name);
 
 int count_cpus(void);
 
+struct buffer_instance *clock_synch_enable(int fd, char *clock,
+					   int *tx_event, int *rx_event);
+void clock_synch_disable(int fd, struct buffer_instance *instance);
+struct tep_handle *clock_synch_get_tep(struct buffer_instance *instance);
+
 /* No longer in event-utils.h */
 void __noreturn die(const char *fmt, ...); /* Can be overriden */
 void *malloc_or_die(unsigned int size); /* Can be overridden */
diff --git a/tracecmd/trace-listen.c b/tracecmd/trace-listen.c
index 9b50147..7783a68 100644
--- a/tracecmd/trace-listen.c
+++ b/tracecmd/trace-listen.c
@@ -404,6 +404,9 @@ static int communicate_with_client(struct tracecmd_msg_handle *msg_handle)
 
 		msg_handle->version = V3_PROTOCOL;
 
+		/* time sync with the v3 client */
+		tracecmd_msg_rcv_time_sync(msg_handle);
+
 		/* read the CPU count, the page size, and options */
 		if ((pagesize = tracecmd_msg_initial_setting(msg_handle)) < 0)
 			goto out;
diff --git a/tracecmd/trace-msg.c b/tracecmd/trace-msg.c
index 46b18aa..b67a53d 100644
--- a/tracecmd/trace-msg.c
+++ b/tracecmd/trace-msg.c
@@ -18,9 +18,11 @@
 #include <stdarg.h>
 #include <string.h>
 #include <unistd.h>
+#include <time.h>
 #include <arpa/inet.h>
 #include <sys/types.h>
 #include <linux/types.h>
+#include <linux/vm_sockets.h>
 
 #include "trace-cmd-local.h"
 #include "trace-local.h"
@@ -28,6 +30,8 @@
 
 typedef __u32 u32;
 typedef __be32 be32;
+typedef __u64 u64;
+typedef __s64 s64;
 
 static inline void dprint(const char *fmt, ...)
 {
@@ -50,11 +54,19 @@ static inline void dprint(const char *fmt, ...)
 
 unsigned int page_size;
 
+/* Try a few times to get an accurate time sync */
+static int tsync_tries = 5000;
+
 struct tracecmd_msg_server {
 	struct tracecmd_msg_handle handle;
 	int			done;
 };
 
+struct clock_synch_event {
+	int			id;
+	unsigned long long	ts;
+};
+
 static struct tracecmd_msg_server *
 make_server(struct tracecmd_msg_handle *msg_handle)
 {
@@ -90,6 +102,16 @@ struct tracecmd_msg_trace_resp {
 	be32 page_size;
 } __attribute__((packed));
 
+struct tracecmd_msg_time_sync_init {
+	char clock[32];
+	s64  toffset;
+} __attribute__((packed));
+
+struct tracecmd_msg_time_sync {
+	u64 tlocal_rx;
+	u64 tlocal_tx;
+} __attribute__((packed));
+
 struct tracecmd_msg_header {
 	be32	size;
 	be32	cmd;
@@ -97,13 +119,15 @@ struct tracecmd_msg_header {
 } __attribute__((packed));
 
 #define MSG_MAP								\
-	C(CLOSE,	0,	0),					\
-	C(TINIT,	1,	sizeof(struct tracecmd_msg_tinit)),	\
-	C(RINIT,	2,	sizeof(struct tracecmd_msg_rinit)),	\
-	C(SEND_DATA,	3,	0),					\
-	C(FIN_DATA,	4,	0),					\
-	C(TRACE_REQ,	5,	sizeof(struct tracecmd_msg_trace_req)),	\
-	C(TRACE_RESP,	6,	sizeof(struct tracecmd_msg_trace_resp)),
+	C(CLOSE,		0, 0),					\
+	C(TINIT,		1, sizeof(struct tracecmd_msg_tinit)),	\
+	C(RINIT,		2, sizeof(struct tracecmd_msg_rinit)),	\
+	C(SEND_DATA,		3, 0),					\
+	C(FIN_DATA,		4, 0),					\
+	C(TRACE_REQ,		5, sizeof(struct tracecmd_msg_trace_req)),\
+	C(TRACE_RESP,		6, sizeof(struct tracecmd_msg_trace_resp)),\
+	C(TIME_SYNC_INIT,	7, sizeof(struct tracecmd_msg_time_sync_init)),\
+	C(TIME_SYNC,		8, sizeof(struct tracecmd_msg_time_sync)),
 
 #undef C
 #define C(a,b,c)	MSG_##a = b
@@ -133,10 +157,12 @@ static const char *cmd_to_name(int cmd)
 struct tracecmd_msg {
 	struct tracecmd_msg_header		hdr;
 	union {
-		struct tracecmd_msg_tinit	tinit;
-		struct tracecmd_msg_rinit	rinit;
-		struct tracecmd_msg_trace_req	trace_req;
-		struct tracecmd_msg_trace_resp	trace_resp;
+		struct tracecmd_msg_tinit		tinit;
+		struct tracecmd_msg_rinit		rinit;
+		struct tracecmd_msg_trace_req		trace_req;
+		struct tracecmd_msg_trace_resp		trace_resp;
+		struct tracecmd_msg_time_sync_init	time_sync_init;
+		struct tracecmd_msg_time_sync		time_sync;
 	};
 	union {
 		struct tracecmd_msg_opt		*opt;
@@ -825,6 +851,269 @@ out:
 	return ret;
 }
 
+static int
+find_events_in_page(struct tep_handle *pevent, void *page,
+		    int size, struct clock_synch_event *events)
+{
+	struct tep_event *event = NULL;
+	struct tep_record *last_record = NULL;
+	struct tep_record *record;
+	int id, i, j, cnt = 0;
+
+	if (size <= 0)
+		return 0;
+	for (i = 0; events[i].id; i++) {
+		if (!events[i].ts)
+			cnt++;
+	}
+
+	while (cnt) {
+		event = NULL;
+		record = tracecmd_read_page_record(pevent, page, size,
+						   last_record);
+		if (!record)
+			break;
+		free_record(last_record);
+		id = tep_data_type(pevent, record);
+		for (i = 0; events[i].id; i++)
+			if (!events[i].ts && events[i].id == id) {
+				event = tep_data_event_from_type(pevent, id);
+				break;
+			}
+		if (event) {
+			for (j = 0; j < i; j++)
+				if (events[j].ts && events[j].ts > record->ts)
+					break;
+			if (j == i) {
+				events[i].ts = record->ts;
+				cnt--;
+			}
+		}
+		last_record = record;
+	}
+	free_record(last_record);
+
+	return cnt;
+}
+
+static int clock_synch_find_events(struct tep_handle *tep,
+				   struct buffer_instance *instance,
+				   struct clock_synch_event *events)
+{
+	struct dirent *dent;
+	int ts = 0;
+	void *page;
+	char *path;
+	char *file;
+	DIR *dir;
+	int len;
+	int fd;
+	int r;
+
+	page_size = getpagesize();
+
+	path = get_instance_file(instance, "per_cpu");
+	if (!path)
+		return ts;
+
+	dir = opendir(path);
+	if (!dir)
+		goto out;
+
+	len = strlen(path);
+	file = malloc(len + strlen("trace_pipe_raw") + 32);
+	page = malloc(page_size);
+	if (!file || !page)
+		die("Failed to allocate time_stamp info");
+
+	while ((dent = readdir(dir))) {
+
+		const char *name = dent->d_name;
+
+		if (strncmp(name, "cpu", 3) != 0)
+			continue;
+		sprintf(file, "%s/%s/trace_pipe_raw", path, name);
+		fd = open(file, O_RDONLY | O_NONBLOCK);
+		if (fd < 0)
+			continue;
+		do {
+			r = read(fd, page, page_size);
+			if (r > 0) {
+				ts = find_events_in_page(tep, page, r, events);
+				if (!ts)
+					break;
+			}
+		} while (r > 0);
+		close(fd);
+	}
+
+	free(file);
+	free(page);
+	closedir(dir);
+
+ out:
+	tracecmd_put_tracing_file(path);
+	return ts;
+}
+
+extern struct tep_handle *clock_synch_get_tep(struct buffer_instance *instance);
+
+int tracecmd_msg_rcv_time_sync(struct tracecmd_msg_handle *msg_handle)
+{
+	struct buffer_instance *vinst;
+	struct tracecmd_msg msg;
+	struct tep_handle *tep;
+	int ret;
+	char *clock;
+	struct clock_synch_event events[3];
+
+	ret = tracecmd_msg_recv(msg_handle->fd, &msg);
+	if (ret < 0 || ntohl(msg.hdr.cmd) != MSG_TIME_SYNC_INIT)
+		return 0;
+	if (!msg.time_sync_init.clock[0])
+		return 0;
+
+	clock = strdup(msg.time_sync_init.clock);
+	events[2].id = 0;
+	vinst = clock_synch_enable(msg_handle->fd, clock,
+				   &events[1].id, &events[0].id);
+	tep = clock_synch_get_tep(vinst);
+	tracecmd_msg_init(MSG_TIME_SYNC_INIT, &msg);
+	tracecmd_msg_send(msg_handle->fd, &msg);
+
+	do {
+		events[0].ts = 0;
+		events[1].ts = 0;
+		ret = tracecmd_msg_recv(msg_handle->fd, &msg);
+		if (ret < 0 || ntohl(msg.hdr.cmd) != MSG_TIME_SYNC)
+			break;
+
+		tracecmd_msg_send(msg_handle->fd, &msg);
+		clock_synch_find_events(tep, vinst, events);
+		tracecmd_msg_init(MSG_TIME_SYNC, &msg);
+		msg.time_sync.tlocal_tx = htonll(events[1].ts);
+		msg.time_sync.tlocal_rx = htonll(events[0].ts);
+		tracecmd_msg_send(msg_handle->fd, &msg);
+	} while (true);
+	clock_synch_disable(msg_handle->fd, vinst);
+	if (ntohl(msg.hdr.cmd) == MSG_TIME_SYNC_INIT)
+		printf("\n\rtimeoffset  %lld\n\r", msg.time_sync_init.toffset);
+	msg_free(&msg);
+	tep_free(tep);
+	free(clock);
+	return ret;
+}
+
+int tracecmd_msg_snd_time_sync(struct tracecmd_msg_handle *msg_handle,
+			       char *clock_str, long long *toffset)
+{
+	static struct buffer_instance *vinst;
+	struct tep_handle *tep;
+	unsigned long long path;
+	unsigned long long min_l = 0;
+	long long ms_diff, sm_diff;
+	long long m_t1, m_t4;
+	long long s_t2, s_t3;
+	long long ptp_off, t_offs;
+	int	pos = 0;
+	int	neg = 0;
+	long long ptp_n = 0;
+	long long ptp_p = 0;
+	int ok_loop, sync_loop = tsync_tries;
+	struct tracecmd_msg msg_req;
+	struct tracecmd_msg msg_resp;
+	int ret = 0;
+	char *clock;
+	struct clock_synch_event events[4];
+
+	clock = clock_str;
+	if (!clock)
+		clock = "local";
+
+	tracecmd_msg_init(MSG_TIME_SYNC_INIT, &msg_req);
+	if (toffset == NULL) {
+		msg_req.time_sync_init.clock[0] = 0;
+		tracecmd_msg_send(msg_handle->fd, &msg_req);
+		return 0;
+	}
+	strncpy(msg_req.time_sync_init.clock, clock, 16);
+	tracecmd_msg_send(msg_handle->fd, &msg_req);
+	ret = tracecmd_msg_recv(msg_handle->fd, &msg_resp);
+	if (ret < 0 || ntohl(msg_resp.hdr.cmd) != MSG_TIME_SYNC_INIT)
+		return 0;
+	events[3].id = 0;
+	vinst = clock_synch_enable(msg_handle->fd, clock_str,
+				   &events[0].id, &events[1].id);
+	events[2].ts = events[1].id;
+	tep = clock_synch_get_tep(vinst);
+	*toffset = 0;
+	ok_loop =  0;
+	do {
+		memset(&msg_resp, 0, sizeof(msg_resp));
+		events[0].ts = 0;
+		events[1].ts = 0;
+		events[2].ts = 0;
+		tracecmd_msg_init(MSG_TIME_SYNC, &msg_req);
+
+		tracecmd_msg_send(msg_handle->fd, &msg_req);
+		ret = tracecmd_msg_recv(msg_handle->fd, &msg_resp);
+		if (ret < 0 || ntohl(msg_resp.hdr.cmd) != MSG_TIME_SYNC)
+			break;
+		ret = tracecmd_msg_recv(msg_handle->fd, &msg_resp);
+		if (ret < 0 || ntohl(msg_resp.hdr.cmd) != MSG_TIME_SYNC)
+			break;
+		clock_synch_find_events(tep, vinst, events);
+		m_t1 = events[0].ts;
+		m_t4 = events[1].ts;
+		s_t2 = htonll(msg_resp.time_sync.tlocal_rx);
+		s_t3 = ntohll(msg_resp.time_sync.tlocal_tx);
+		if (!m_t1 || !m_t4 || !s_t2 || !s_t3)
+			continue;
+		ok_loop++;
+		path = m_t4 - m_t1;
+		ms_diff = s_t2 - m_t1;
+		sm_diff = m_t4 - s_t3;
+		if (!min_l || min_l > path) {
+			min_l = path;
+
+			if (ms_diff >= sm_diff) {
+				ptp_off = (ms_diff - sm_diff)/2;
+			} else {
+				ptp_off = (sm_diff - ms_diff)/2;
+				ptp_off = -ptp_off;
+			}
+		}
+		if (ms_diff >= sm_diff) {
+			ptp_p += (ms_diff - sm_diff)/2;
+			pos++;
+		} else {
+			ptp_n += (sm_diff - ms_diff)/2;
+			neg++;
+		}
+	} while (--sync_loop);
+
+	clock_synch_disable(msg_handle->fd, vinst);
+
+	if (pos)
+		t_offs = ptp_p/pos;
+	else if (neg)
+		t_offs = -(ptp_n/neg);
+
+	tracecmd_msg_init(MSG_TIME_SYNC_INIT, &msg_req);
+	msg_req.time_sync_init.clock[0] = 0;
+	msg_req.time_sync_init.toffset = ptp_off;
+	tracecmd_msg_send(msg_handle->fd, &msg_req);
+
+	msg_free(&msg_req);
+	msg_free(&msg_resp);
+#if 0
+	*toffset = t_offs;
+#else
+	*toffset = ptp_off;
+#endif
+	return ret;
+}
+
 static int make_trace_resp(struct tracecmd_msg *msg,
 			   int page_size, int nr_cpus, unsigned int *ports)
 {
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 4c3df3d..f8028f3 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -3159,7 +3159,36 @@ static void check_protocol_version(struct tracecmd_msg_handle *msg_handle)
 	}
 }
 
-static struct tracecmd_msg_handle *setup_network(struct buffer_instance *instance)
+static void sync_time_with_listener_v3(struct tracecmd_msg_handle *msg_handle,
+				       struct common_record_context *ctx)
+{
+	long long toffset = 0;
+
+	if (ctx->data_flags & DATA_FL_DATE ||
+	    ctx->data_flags & DATA_FL_OFFSET) {
+		tracecmd_msg_snd_time_sync(msg_handle, ctx->clock, NULL);
+		return;
+	}
+
+	tracecmd_msg_snd_time_sync(msg_handle, ctx->clock, &toffset);
+
+	free(ctx->date2ts);
+	/* 20 digits + \0 */
+	ctx->date2ts = malloc(21);
+	if (ctx->date2ts) {
+		if (toffset < 0) {
+			snprintf(ctx->date2ts, 19, "0x%llx", -toffset);
+			ctx->data_flags |= DATA_FL_OFFSET_N;
+		} else {
+			snprintf(ctx->date2ts, 19, "0x%llx", toffset);
+			ctx->data_flags |= DATA_FL_OFFSET;
+		}
+	}
+
+}
+
+static struct tracecmd_msg_handle *setup_network(struct buffer_instance *instance,
+						 struct common_record_context *ctx)
 {
 	struct tracecmd_msg_handle *msg_handle = NULL;
 	struct addrinfo hints;
@@ -3296,12 +3325,13 @@ static void add_options(struct tracecmd_output *handle,
 }
 
 static struct tracecmd_msg_handle *
-setup_connection(struct buffer_instance *instance, struct common_record_context *ctx)
+setup_connection(struct buffer_instance *instance,
+		 struct common_record_context *ctx)
 {
 	struct tracecmd_msg_handle *msg_handle;
 	struct tracecmd_output *network_handle;
 
-	msg_handle = setup_network(instance);
+	msg_handle = setup_network(instance, ctx);
 
 	/* Now create the handle through this socket */
 	if (msg_handle->version == V3_PROTOCOL) {
@@ -3328,7 +3358,8 @@ static void finish_network(struct tracecmd_msg_handle *msg_handle)
 	free(host);
 }
 
-static void connect_to_agent(struct buffer_instance *instance)
+static void connect_to_agent(struct buffer_instance *instance,
+			     struct common_record_context *ctx)
 {
 	struct tracecmd_msg_handle *msg_handle;
 	int sd, nr_cpus, page_size;
@@ -3354,9 +3385,12 @@ static void connect_to_agent(struct buffer_instance *instance)
 
 	/* the msg_handle now points to the guest fd */
 	instance->msg_handle = msg_handle;
+
+	tracecmd_msg_rcv_time_sync(msg_handle);
 }
 
-static void setup_guest(struct buffer_instance *instance)
+static void setup_guest(struct buffer_instance *instance,
+			struct common_record_context *ctx)
 {
 	struct tracecmd_msg_handle *msg_handle = instance->msg_handle;
 	char *file;
@@ -3378,10 +3412,13 @@ static void setup_guest(struct buffer_instance *instance)
 	close(fd);
 }
 
-static void setup_agent(struct buffer_instance *instance, struct common_record_context *ctx)
+static void setup_agent(struct buffer_instance *instance,
+			struct common_record_context *ctx)
 {
 	struct tracecmd_output *network_handle;
 
+	sync_time_with_listener_v3(instance->msg_handle, ctx);
+
 	network_handle = tracecmd_create_init_fd_msg(instance->msg_handle,
 						     listed_events);
 	add_options(network_handle, ctx);
@@ -3401,7 +3438,7 @@ void start_threads(enum trace_type type, struct common_record_context *ctx)
 	for_all_instances(instance) {
 		/* Start the connection now to find out how many CPUs we need */
 		if (instance->flags & BUFFER_FL_GUEST)
-			connect_to_agent(instance);
+			connect_to_agent(instance, ctx);
 		total_cpu_count += instance->cpu_count;
 	}
 
@@ -3417,7 +3454,7 @@ void start_threads(enum trace_type type, struct common_record_context *ctx)
 		if (instance->flags & BUFFER_FL_AGENT) {
 			setup_agent(instance, ctx);
 		} else if (instance->flags & BUFFER_FL_GUEST) {
-			setup_guest(instance);
+			setup_guest(instance, ctx);
 		} else if (host) {
 			instance->msg_handle = setup_connection(instance, ctx);
 			if (!instance->msg_handle)
@@ -5774,3 +5811,151 @@ int trace_record_agent(struct tracecmd_msg_handle *msg_handle,
 	free(argv_plus);
 	return 0;
 }
+
+static void get_vsocket_params(int fd, int *lcid,
+			       int *lport, int *rcid, int *rport)
+{
+	struct sockaddr_vm addr;
+	socklen_t addr_len = sizeof(addr);
+
+	memset(&addr, 0, sizeof(addr));
+	if (getsockname(fd, (struct sockaddr *)&addr, &addr_len))
+		return;
+	if (addr.svm_family != AF_VSOCK)
+		return;
+	*lport = addr.svm_port;
+	*lcid = addr.svm_cid;
+
+	memset(&addr, 0, sizeof(addr));
+	addr_len = sizeof(addr);
+	if (getpeername(fd, (struct sockaddr *)&addr, &addr_len))
+		return;
+	if (addr.svm_family != AF_VSOCK)
+		return;
+
+	*rport = addr.svm_port;
+	*rcid = addr.svm_cid;
+}
+
+static void set_clock_synch_events(int cfd, struct buffer_instance *instance,
+				   bool enable, int *tx_event, int *rx_event)
+{
+	int lcid, lport, rcid, rport;
+	char buffer[255];
+	FILE *fp;
+	char *path;
+	int fd;
+
+	path = get_instance_file(instance, "events/vsock/enable");
+	fd = open(path, O_WRONLY);
+	if (fd < 0)
+		return;
+	if (enable)
+		write(fd, "1", 2);
+	else
+		write(fd, "0", 2);
+	close(fd);
+	tracecmd_put_tracing_file(path);
+
+	if (enable) {
+		get_vsocket_params(cfd, &lcid, &lport, &rcid, &rport);
+
+		snprintf(buffer, 255,
+			"src_cid==%d && src_port==%d && dst_cid==%d && dst_port==%d && len!=0",
+			rcid, rport, lcid, lport);
+		path = get_instance_file(instance,
+					 "events/vsock/virtio_transport_recv_pkt/filter");
+		fd = open(path, O_WRONLY);
+		write(fd, buffer, strlen(buffer)+1);
+		close(fd);
+		tracecmd_put_tracing_file(path);
+
+		snprintf(buffer, 255,
+			"src_cid==%d && src_port==%d && dst_cid==%d && dst_port==%d && len!=0",
+			lcid, lport, rcid, rport);
+		path = get_instance_file(instance,
+					 "events/vsock/virtio_transport_alloc_pkt/filter");
+		fd = open(path, O_WRONLY);
+		write(fd, buffer, strlen(buffer)+1);
+		close(fd);
+		tracecmd_put_tracing_file(path);
+
+		if (tx_event) {
+			path = get_instance_file(instance,
+						 "events/vsock/virtio_transport_alloc_pkt/id");
+			fp = fopen(path, "r");
+			fgets(buffer, 255, (FILE *) fp);
+			*tx_event = atoi(buffer);
+			fclose(fp);
+			tracecmd_put_tracing_file(path);
+		}
+		if (rx_event) {
+			path = get_instance_file(instance,
+						 "events/vsock/virtio_transport_recv_pkt/id");
+			fp = fopen(path, "r");
+			fgets(buffer, 255, (FILE *) fp);
+			*rx_event = atoi(buffer);
+			fclose(fp);
+			tracecmd_put_tracing_file(path);
+		}
+	}
+
+	path = get_instance_file(instance, "events/vsock/enable");
+
+	if (enable)
+		write_tracing_on(instance, 1);
+	else
+		write_tracing_on(instance, 0);
+}
+
+static void vsock_trace_reset(struct buffer_instance *vinst)
+{
+	char *path;
+	int fd;
+
+	path = get_instance_file(vinst, "trace");
+	fd = open(path, O_WRONLY);
+	tracecmd_put_tracing_file(path);
+	write(fd, "0", 2);
+	close(fd);
+}
+
+struct tep_handle *clock_synch_get_tep(struct buffer_instance *instance)
+{
+	struct tep_handle *tep = NULL;
+	char *path;
+
+	path = get_instance_dir(instance);
+	tep = tracecmd_local_events_system(path, "vsock");
+	tracecmd_put_tracing_file(path);
+
+	tep_set_file_bigendian(tep, tracecmd_host_bigendian());
+	tep_set_host_bigendian(tep, tracecmd_host_bigendian());
+
+	return tep;
+}
+
+struct buffer_instance *clock_synch_enable(int fd, char *clock,
+					   int *tx_event, int *rx_event)
+{
+	char inst_name[256];
+	struct buffer_instance *vinst;
+
+	snprintf(inst_name, 256, "clock_synch-%d", rand()%100);
+	vinst = create_instance(strdup(inst_name));
+	init_instance(vinst);
+	vinst->cpu_count = local_cpu_count;
+	make_one_instances(vinst);
+	vsock_trace_reset(vinst);
+	vinst->clock = strdup(clock);
+	set_clock(vinst);
+	set_clock_synch_events(fd, vinst, true, tx_event, rx_event);
+	return vinst;
+}
+
+void clock_synch_disable(int fd, struct buffer_instance *instance)
+{
+	set_clock_synch_events(fd, instance, false, NULL, NULL);
+	tracecmd_remove_one_instance(instance);
+	/* todo: clean up the instance */
+}
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/7] trace-cmd: Implemented new lib API: tracecmd_local_events_system()
  2019-01-16 19:18 ` [PATCH 1/7] trace-cmd: Implemented new lib API: tracecmd_local_events_system() Tzvetomir Stoyanov
@ 2019-01-21  9:02   ` Steven Rostedt
  0 siblings, 0 replies; 17+ messages in thread
From: Steven Rostedt @ 2019-01-21  9:02 UTC (permalink / raw)
  To: Tzvetomir Stoyanov; +Cc: linux-trace-devel

On Wed, 16 Jan 2019 21:18:32 +0200
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:

> +static int tracecmd_fill_local_events_system(const char *tracing_dir,
> +					     struct tep_handle *pevent,
> +					     char *sys_name)
>  {
>  	struct dirent *dent;
>  	char *events_dir;
> @@ -1189,7 +1161,8 @@ int tracecmd_fill_local_events(const char *tracing_dir, struct tep_handle *peven
>  		if (strcmp(name, ".") == 0 ||
>  		    strcmp(name, "..") == 0)
>  			continue;
> -
> +		if (sys_name && strcmp(name, sys_name))

Small nit. Please compare as: strcmp(name, sys_name) != 0

This to make it look like it is not equal. One of the flaws of the
"strcmp" is that a match is false and a non match is true, which makes
it likely to be done wrong :-p

If you noticed, the strcmp() in the previous if uses "== 0" as a way to
say "this is true on match"


> +			continue;
>  		sys = append_file(events_dir, name);
>  		ret = stat(sys, &st);
>  		if (ret < 0 || !S_ISDIR(st.st_mode)) {
> @@ -1217,6 +1190,58 @@ int tracecmd_fill_local_events(const char *tracing_dir, struct tep_handle *peven
>  	return ret;
>  }
>  
> +/**
> + * tracecmd_local_events_system - create a tep from the
> + * events of the specified subsystem.

Keep the above on one line, even though it breaks the 80 character
limit.

-- Steve

> + *
> + * @tracing_dir: The directory that contains the events.
> + * @sys_name: Name of the subsystem, to load events from
> + *
> + * Returns a tep structure that contains the tep local to
> + * the system.
> + */
> +struct tep_handle *tracecmd_local_events_system(const char *tracing_dir,
> +						char *sys_name)
> +{
> +	struct tep_handle *tep = NULL;
> +
> +	tep = tep_alloc();
> +	if (!tep)
> +		return NULL;
> +
> +	if (tracecmd_fill_local_events_system(tracing_dir, tep, sys_name)) {
> +		tep_free(tep);
> +		tep = NULL;
> +	}
> +
> +	return tep;
> +}
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/7] trace-cmd: Added new option in trace.dat file for negative time offsets
  2019-01-16 19:18 ` [PATCH 2/7] trace-cmd: Added new option in trace.dat file for negative time offsets Tzvetomir Stoyanov
@ 2019-01-21  9:08   ` Steven Rostedt
  2019-01-22 13:28     ` Tzvetomir Stoyanov
  0 siblings, 1 reply; 17+ messages in thread
From: Steven Rostedt @ 2019-01-21  9:08 UTC (permalink / raw)
  To: Tzvetomir Stoyanov; +Cc: linux-trace-devel

On Wed, 16 Jan 2019 21:18:33 +0200
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:

> diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
> index b628570..de15d4b 100644
> --- a/lib/trace-cmd/trace-input.c
> +++ b/lib/trace-cmd/trace-input.c
> @@ -2151,6 +2151,7 @@ static int handle_options(struct tracecmd_input *handle)
>  			handle->ts_offset += offset;
>  			break;
>  		case TRACECMD_OPTION_OFFSET:
> +		case TRACECMD_OPTION_OFFSET_N:
>  			/*
>  			 * Similar to date option, but just adds an
>  			 * offset to the timestamp.
> @@ -2158,7 +2159,11 @@ static int handle_options(struct tracecmd_input *handle)
>  			if (handle->flags & TRACECMD_FL_IGNORE_DATE)
>  				break;
>  			offset = strtoll(buf, NULL, 0);
> -			handle->ts_offset += offset;
> +			if (option == TRACECMD_OPTION_OFFSET_N) {

Instead of adding a new option, couldn't we just make option a "long
long" and save a negative number in the trace.dat file? strtoll()
should be able to handle it.

-- Steve


> +				if (handle->ts_offset > offset)
> +					handle->ts_offset -= offset;
> +			} else
> +				handle->ts_offset += offset;
>  			break;
>  		case TRACECMD_OPTION_CPUSTAT:
>  			buf[size-1] = '\n';

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/7] trace-cmd: Fixed logic in tracecmd_read_page_record()
  2019-01-16 19:18 ` [PATCH 3/7] trace-cmd: Fixed logic in tracecmd_read_page_record() Tzvetomir Stoyanov
@ 2019-01-21  9:09   ` Steven Rostedt
  2019-01-22 13:36     ` Tzvetomir Stoyanov
  0 siblings, 1 reply; 17+ messages in thread
From: Steven Rostedt @ 2019-01-21  9:09 UTC (permalink / raw)
  To: Tzvetomir Stoyanov; +Cc: linux-trace-devel

On Wed, 16 Jan 2019 21:18:34 +0200
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:

> Fixed the logic in tracecmd_read_page_record() when
> searching for the next event in the event from the
> ring buffer.

Please explain what you are fixing. In other words, what was wrong with
the current logic?

-- Steve

> 
> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> ---

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 6/7] trace-cmd: Refactored make_instances() and tracecmd_remove_instances()
  2019-01-16 19:18 ` [PATCH 6/7] trace-cmd: Refactored make_instances() and tracecmd_remove_instances() Tzvetomir Stoyanov
@ 2019-01-21  9:13   ` Steven Rostedt
  0 siblings, 0 replies; 17+ messages in thread
From: Steven Rostedt @ 2019-01-21  9:13 UTC (permalink / raw)
  To: Tzvetomir Stoyanov; +Cc: linux-trace-devel

On Wed, 16 Jan 2019 21:18:37 +0200
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:


> --- a/tracecmd/trace-record.c
> +++ b/tracecmd/trace-record.c
> @@ -4260,49 +4260,57 @@ static void clear_func_filters(void)
>  	}
>  }
>  
> -static void make_instances(void)
> +static void make_one_instances(struct buffer_instance *instance)

> +static void tracecmd_remove_one_instance(struct buffer_instance *instance)


I would just make the names non plural, and call them:

make_one_instance()
tracecmd_remove_instance()

-- Steve

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 5/7] trace-cmd: Added user configured clock to the record context
  2019-01-16 19:18 ` [PATCH 5/7] trace-cmd: Added user configured clock to the record context Tzvetomir Stoyanov
@ 2019-01-21  9:19   ` Steven Rostedt
  2019-01-22 13:43     ` Tzvetomir Stoyanov
  0 siblings, 1 reply; 17+ messages in thread
From: Steven Rostedt @ 2019-01-21  9:19 UTC (permalink / raw)
  To: Tzvetomir Stoyanov; +Cc: linux-trace-devel

On Wed, 16 Jan 2019 21:18:36 +0200
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:

> Store the user configured clock (if any) in the record context,
> struct common_record_context. The clock is going to be used when
> synchronizing timestamps with remote tracing machine.
> ---
>  tracecmd/trace-record.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
> index f7349eb..900d0d4 100644
> --- a/tracecmd/trace-record.c
> +++ b/tracecmd/trace-record.c
> @@ -227,6 +227,7 @@ struct common_record_context {
>  	int topt;
>  	int do_child;
>  	int run_command;
> +	char *clock;
>  };
>  
>  static void add_reset_file(const char *file, const char *val, int prio)
> @@ -5183,6 +5184,7 @@ static void parse_record_options(int argc,
>  			break;
>  		case 'C':
>  			ctx->instance->clock = optarg;
> +			ctx->clock = optarg;

Hmm, this can cause an issue. The first thing I have to ask is, why
can't we use ctx->instance->clock. I'm sure the answer is that we are
adding more than one clock. But this begs the question, which clock
should be use, if there are more than one clock to add?

I think this patch is not needed. In the last patch, test if
ctx->instance->clock exists, and if not, we search the other instances
for a clock to use. Or something else that doesn't make which clock to
use ambiguous.

-- Steve

>  			break;
>  		case 'v':
>  			neg_event = 1;


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/7] trace-cmd: Added new option in trace.dat file for negative time offsets
  2019-01-21  9:08   ` Steven Rostedt
@ 2019-01-22 13:28     ` Tzvetomir Stoyanov
  0 siblings, 0 replies; 17+ messages in thread
From: Tzvetomir Stoyanov @ 2019-01-22 13:28 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-trace-devel

On Mon, Jan 21, 2019 at 11:08 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Wed, 16 Jan 2019 21:18:33 +0200
> Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:
>
> > diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
> > index b628570..de15d4b 100644
> > --- a/lib/trace-cmd/trace-input.c
> > +++ b/lib/trace-cmd/trace-input.c
> > @@ -2151,6 +2151,7 @@ static int handle_options(struct tracecmd_input *handle)
> >                       handle->ts_offset += offset;
> >                       break;
> >               case TRACECMD_OPTION_OFFSET:
> > +             case TRACECMD_OPTION_OFFSET_N:
> >                       /*
> >                        * Similar to date option, but just adds an
> >                        * offset to the timestamp.
> > @@ -2158,7 +2159,11 @@ static int handle_options(struct tracecmd_input *handle)
> >                       if (handle->flags & TRACECMD_FL_IGNORE_DATE)
> >                               break;
> >                       offset = strtoll(buf, NULL, 0);
> > -                     handle->ts_offset += offset;
> > +                     if (option == TRACECMD_OPTION_OFFSET_N) {
>
> Instead of adding a new option, couldn't we just make option a "long
> long" and save a negative number in the trace.dat file? strtoll()
> should be able to handle it.

Yes,  we can make in long long, but this will break the backward compatibility.
The old versions of  trace-cmd will get confused, as they will cast it
to unsigned.
That's why I added a new option, in this way old trace-cmd versions
will not read the
negative offset at all.

>
> -- Steve
>
>
> > +                             if (handle->ts_offset > offset)
> > +                                     handle->ts_offset -= offset;
> > +                     } else
> > +                             handle->ts_offset += offset;
> >                       break;
> >               case TRACECMD_OPTION_CPUSTAT:
> >                       buf[size-1] = '\n';



-- 

Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/7] trace-cmd: Fixed logic in tracecmd_read_page_record()
  2019-01-21  9:09   ` Steven Rostedt
@ 2019-01-22 13:36     ` Tzvetomir Stoyanov
  0 siblings, 0 replies; 17+ messages in thread
From: Tzvetomir Stoyanov @ 2019-01-22 13:36 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-trace-devel

On Mon, Jan 21, 2019 at 11:09 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Wed, 16 Jan 2019 21:18:34 +0200
> Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:
>
> > Fixed the logic in tracecmd_read_page_record() when
> > searching for the next event in the event from the
> > ring buffer.
>
> Please explain what you are fixing. In other words, what was wrong with
> the current logic?

In the current logic, in the case when last_record is not NULL (we are
searching for the second one)
the check "if (ptr != last_record->data)" always fails. As I can
understand, kbuffer_next_event() reads the event
after the one pointed by last_record. In my use case I search for a
series of few events,
tracecmd_read_page_record() returns the first one (when I pass
last_record=NULL), and always fails on
the second one with the error "tracecmd_read_page_record: could not
find last_record". I use a gdb to figure out
what happens there.

>
> -- Steve
>
> >
> > Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> > ---



-- 

Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 5/7] trace-cmd: Added user configured clock to the record context
  2019-01-21  9:19   ` Steven Rostedt
@ 2019-01-22 13:43     ` Tzvetomir Stoyanov
  2019-01-22 14:14       ` Slavomir Kaslev
  0 siblings, 1 reply; 17+ messages in thread
From: Tzvetomir Stoyanov @ 2019-01-22 13:43 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-trace-devel

On Mon, Jan 21, 2019 at 11:19 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Wed, 16 Jan 2019 21:18:36 +0200
> Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:
>
> > Store the user configured clock (if any) in the record context,
> > struct common_record_context. The clock is going to be used when
> > synchronizing timestamps with remote tracing machine.
> > ---
> >  tracecmd/trace-record.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
> > index f7349eb..900d0d4 100644
> > --- a/tracecmd/trace-record.c
> > +++ b/tracecmd/trace-record.c
> > @@ -227,6 +227,7 @@ struct common_record_context {
> >       int topt;
> >       int do_child;
> >       int run_command;
> > +     char *clock;
> >  };
> >
> >  static void add_reset_file(const char *file, const char *val, int prio)
> > @@ -5183,6 +5184,7 @@ static void parse_record_options(int argc,
> >                       break;
> >               case 'C':
> >                       ctx->instance->clock = optarg;
> > +                     ctx->clock = optarg;
>
> Hmm, this can cause an issue. The first thing I have to ask is, why
> can't we use ctx->instance->clock. I'm sure the answer is that we are
> adding more than one clock. But this begs the question, which clock
> should be use, if there are more than one clock to add?
>
> I think this patch is not needed. In the last patch, test if
> ctx->instance->clock exists, and if not, we search the other instances
> for a clock to use. Or something else that doesn't make which clock to
> use ambiguous.

Ok, I'll remove it and will search for the first ctx->instance->clock instead.
Current algorithm assumes that only one clock is used, and it is the
same in both
host and guest contexts. We should think how to handle the case with
multiple instances,
each one with different clock. I do not know, how instances are
written in the trace.dat file,
is there a different time offset option in the file, per instance ?

>
> -- Steve
>
> >                       break;
> >               case 'v':
> >                       neg_event = 1;
>


-- 

Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 5/7] trace-cmd: Added user configured clock to the record context
  2019-01-22 13:43     ` Tzvetomir Stoyanov
@ 2019-01-22 14:14       ` Slavomir Kaslev
  0 siblings, 0 replies; 17+ messages in thread
From: Slavomir Kaslev @ 2019-01-22 14:14 UTC (permalink / raw)
  To: Tzvetomir Stoyanov; +Cc: Steven Rostedt, linux-trace-devel

On Tue, Jan 22, 2019 at 3:44 PM Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:
>
> On Mon, Jan 21, 2019 at 11:19 AM Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > On Wed, 16 Jan 2019 21:18:36 +0200
> > Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:
> >
> > > Store the user configured clock (if any) in the record context,
> > > struct common_record_context. The clock is going to be used when
> > > synchronizing timestamps with remote tracing machine.
> > > ---
> > >  tracecmd/trace-record.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
> > > index f7349eb..900d0d4 100644
> > > --- a/tracecmd/trace-record.c
> > > +++ b/tracecmd/trace-record.c
> > > @@ -227,6 +227,7 @@ struct common_record_context {
> > >       int topt;
> > >       int do_child;
> > >       int run_command;
> > > +     char *clock;
> > >  };
> > >
> > >  static void add_reset_file(const char *file, const char *val, int prio)
> > > @@ -5183,6 +5184,7 @@ static void parse_record_options(int argc,
> > >                       break;
> > >               case 'C':
> > >                       ctx->instance->clock = optarg;
> > > +                     ctx->clock = optarg;
> >
> > Hmm, this can cause an issue. The first thing I have to ask is, why
> > can't we use ctx->instance->clock. I'm sure the answer is that we are
> > adding more than one clock. But this begs the question, which clock
> > should be use, if there are more than one clock to add?
> >
> > I think this patch is not needed. In the last patch, test if
> > ctx->instance->clock exists, and if not, we search the other instances
> > for a clock to use. Or something else that doesn't make which clock to
> > use ambiguous.
>
> Ok, I'll remove it and will search for the first ctx->instance->clock instead.
> Current algorithm assumes that only one clock is used, and it is the
> same in both
> host and guest contexts. We should think how to handle the case with
> multiple instances,
> each one with different clock. I do not know, how instances are
> written in the trace.dat file,
> is there a different time offset option in the file, per instance ?

Each instance goes into a separate file (by default "trace-$(name).dat").

For guest instances, this command
$ trace-cmd record -A guest0 -e irq -e sched -A guest1 -e irq -e sched

creates two trace files:
-rw-r--r-- 1 4.8M Jan 22 16:06 trace-guest0.dat
-rw-r--r-- 1 7.4M Jan 22 16:06 trace-guest1.dat

Cheers,

- Slavi

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, back to index

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-16 19:18 [PATCH 0/7] trace-cmd [POC]: Timestamps sync using PTP-like algorithm, relying on vsock events Tzvetomir Stoyanov
2019-01-16 19:18 ` [PATCH 1/7] trace-cmd: Implemented new lib API: tracecmd_local_events_system() Tzvetomir Stoyanov
2019-01-21  9:02   ` Steven Rostedt
2019-01-16 19:18 ` [PATCH 2/7] trace-cmd: Added new option in trace.dat file for negative time offsets Tzvetomir Stoyanov
2019-01-21  9:08   ` Steven Rostedt
2019-01-22 13:28     ` Tzvetomir Stoyanov
2019-01-16 19:18 ` [PATCH 3/7] trace-cmd: Fixed logic in tracecmd_read_page_record() Tzvetomir Stoyanov
2019-01-21  9:09   ` Steven Rostedt
2019-01-22 13:36     ` Tzvetomir Stoyanov
2019-01-16 19:18 ` [PATCH 4/7] trace-cmd: Added implementation of htonll() and ntohll() Tzvetomir Stoyanov
2019-01-16 19:18 ` [PATCH 5/7] trace-cmd: Added user configured clock to the record context Tzvetomir Stoyanov
2019-01-21  9:19   ` Steven Rostedt
2019-01-22 13:43     ` Tzvetomir Stoyanov
2019-01-22 14:14       ` Slavomir Kaslev
2019-01-16 19:18 ` [PATCH 6/7] trace-cmd: Refactored make_instances() and tracecmd_remove_instances() Tzvetomir Stoyanov
2019-01-21  9:13   ` Steven Rostedt
2019-01-16 19:18 ` [PATCH 7/7] trace-cmd [POC]: Implemented timestamps synch PTP-like algorithm, using vsock events Tzvetomir Stoyanov

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org linux-trace-devel@archiver.kernel.org
	public-inbox-index linux-trace-devel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox