All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/5] Final preparation before adding the KernelShark GUI
@ 2018-10-05 18:33 Yordan Karadzhov
  2018-10-05 18:33 ` [PATCH v3 1/5] kernel-shark-qt: Add kshark_get_X_easy() functions Yordan Karadzhov
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Yordan Karadzhov @ 2018-10-05 18:33 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov

Five small patches needed as a final preparation before introducing
the first components of the Qt-based KernelShark GUI.

Yordan Karadzhov (1):
  kernel-shark-qt: Fix a bug in kshark_data_collection_alloc()

Yordan Karadzhov (VMware) (4):
  kernel-shark-qt: Add kshark_get_X_easy() functions.
  kernel-shark-qt: Add kshark_convert_nano() function
  kernel-shark-qt: Add functions for fast clearing of the filters.
  kernel-shark-qt: Rename the Cmake-generated header file.

 kernel-shark-qt/build/cmake_clean.sh       |   2 +-
 kernel-shark-qt/build/deff.h.cmake         |   2 +-
 kernel-shark-qt/src/CMakeLists.txt         |   2 +-
 kernel-shark-qt/src/libkshark-collection.c |  27 ++-
 kernel-shark-qt/src/libkshark.c            | 240 ++++++++++++++++++++-
 kernel-shark-qt/src/libkshark.h            |  20 ++
 6 files changed, 281 insertions(+), 12 deletions(-)

-- 
2.17.1

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

* [PATCH v3 1/5] kernel-shark-qt: Add kshark_get_X_easy() functions.
  2018-10-05 18:33 [PATCH v3 0/5] Final preparation before adding the KernelShark GUI Yordan Karadzhov
@ 2018-10-05 18:33 ` Yordan Karadzhov
  2018-10-05 19:20   ` Steven Rostedt
  2018-10-05 18:33 ` [PATCH v3 2/5] kernel-shark-qt: Add kshark_convert_nano() function Yordan Karadzhov
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Yordan Karadzhov @ 2018-10-05 18:33 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>

The kshark_get_X_easy() functions allow for an easy access to the
tep_record's fields. Using these functions can be inefficient if you
need access to more than one of the fields of the record.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark-qt/src/libkshark.c | 196 ++++++++++++++++++++++++++++++++
 kernel-shark-qt/src/libkshark.h |  12 ++
 2 files changed, 208 insertions(+)

diff --git a/kernel-shark-qt/src/libkshark.c b/kernel-shark-qt/src/libkshark.c
index 506511d..ef577e0 100644
--- a/kernel-shark-qt/src/libkshark.c
+++ b/kernel-shark-qt/src/libkshark.c
@@ -888,6 +888,202 @@ static const char *kshark_get_info(struct tep_handle *pe,
 	return seq.buffer;
 }
 
+/**
+ * @brief This function allows for an easy access to the original value of the
+ *	  Process Id as recorded in the tep_record object. The record is read
+ *	  from the file only in the case of an entry being touched by a plugin.
+ *	  Be aware that using the kshark_get_X_easy functions can be
+ *	  inefficient if you need an access to more than one of the data fields
+ *	  of the record.
+ *
+ * @param entry: Input location for the KernelShark entry.
+ *
+ * @returns The original value of the Process Id as recorded in the
+ *	    tep_record object on success, otherwise negative error code.
+ */
+int kshark_get_pid_easy(struct kshark_entry *entry)
+{
+	struct kshark_context *kshark_ctx = NULL;
+	struct tep_record *data;
+	int pid;
+
+	if (!kshark_instance(&kshark_ctx))
+		return -ENODEV;
+
+	if (entry->visible & KS_PLUGIN_UNTOUCHED_MASK) {
+		pid = entry->pid;
+	} else {
+		/*
+		 * The entry has been touched by a plugin callback function.
+		 * Because of this we do not trust the value of "entry->pid".
+		 */
+		data = kshark_read_at(kshark_ctx, entry->offset);
+		pid = tep_data_pid(kshark_ctx->pevent, data);
+		free_record(data);
+	}
+
+	return pid;
+}
+
+/**
+ * @brief This function allows for an easy access to the original value of the
+ *	  Task name as recorded in the tep_record object. The record is read
+ *	  from the file only in the case of an entry being touched by a plugin.
+ *	  Be aware that using the kshark_get_X_easy functions can be
+ *	  inefficient if you need an access to more than one of the data fields
+ *	  of the record.
+ *
+ * @param entry: Input location for the KernelShark entry.
+ *
+ * @returns The original name of the task, retrieved from the Process Id
+ *	    recorded in the tep_record object on success, otherwise NULL.
+ */
+const char *kshark_get_task_easy(struct kshark_entry *entry)
+{
+	struct kshark_context *kshark_ctx = NULL;
+	int pid = kshark_get_pid_easy(entry);
+
+	if (pid < 0)
+		return NULL;
+
+	kshark_instance(&kshark_ctx);
+	return tep_data_comm_from_pid(kshark_ctx->pevent, pid);
+}
+
+/**
+ * @brief This function allows for an easy access to the latency information
+ *	  recorded in the tep_record object. The record is read from the file
+ *	  using the offset field of kshark_entry. Be aware that using the
+ *	  kshark_get_X_easy functions can be inefficient if you need an access
+ *	  to more than one of the data fields of the record.
+ *
+ * @param entry: Input location for the KernelShark entry.
+ *
+ * @returns On success the function returns a string showing the latency
+ *	    information, coded into 5 fields:
+ *	    interrupts disabled, need rescheduling, hard/soft interrupt,
+ *	    preempt count and lock depth. On failure it returns NULL.
+ */
+const char *kshark_get_latency_easy(struct kshark_entry *entry)
+{
+	struct kshark_context *kshark_ctx = NULL;
+	struct tep_record *data;
+	const char *lat;
+
+	if (!kshark_instance(&kshark_ctx))
+		return NULL;
+
+	data = kshark_read_at(kshark_ctx, entry->offset);
+	lat = kshark_get_latency(kshark_ctx->pevent, data);
+	free_record(data);
+
+	return lat;
+}
+
+/**
+ * @brief This function allows for an easy access to the original value of the
+ *	  Event Id as recorded in the tep_record object. The record is read
+ *	  from the file only in the case of an entry being touched by a plugin.
+ *	  Be aware that using the kshark_get_X_easy functions can be
+ *	  inefficient if you need an access to more than one of the data fields
+ *	  of the record.
+ *
+ * @param entry: Input location for the KernelShark entry.
+ *
+ * @returns The original value of the Event Id as recorded in the
+ *	    tep_record object on success, otherwise negative error code.
+ */
+int kshark_get_event_id_easy(struct kshark_entry *entry)
+{
+	struct kshark_context *kshark_ctx = NULL;
+	struct tep_record *data;
+	int event_id;
+
+	if (!kshark_instance(&kshark_ctx))
+		return -ENODEV;
+
+	if (entry->visible & KS_PLUGIN_UNTOUCHED_MASK) {
+		event_id = entry->event_id;
+	} else {
+		/*
+		 * The entry has been touched by a plugin callback function.
+		 * Because of this we do not trust the value of
+		 * "entry->event_id".
+		 */
+		data = kshark_read_at(kshark_ctx, entry->offset);
+		event_id = tep_data_type(kshark_ctx->pevent, data);
+		free_record(data);
+	}
+
+	return event_id;
+}
+
+/**
+ * @brief This function allows for an easy access to the original name of the
+ *	  trace event as recorded in the tep_record object. The record is read
+ *	  from the file only in the case of an entry being touched by a plugin.
+ *	  Be aware that using the kshark_get_X_easy functions can be
+ *	  inefficient if you need an access to more than one of the data fields
+ *	  of the record.
+ *
+ * @param entry: Input location for the KernelShark entry.
+ *
+ * @returns The mane of the trace event recorded in the tep_record object on
+ *	    success, otherwise "[UNKNOWN EVENT]" or NULL.
+ */
+const char *kshark_get_event_name_easy(struct kshark_entry *entry)
+{
+	struct kshark_context *kshark_ctx = NULL;
+	struct event_format *event;
+
+	int event_id = kshark_get_event_id_easy(entry);
+
+	if (event_id < 0)
+		return NULL;
+
+	kshark_instance(&kshark_ctx);
+	event = tep_data_event_from_type(kshark_ctx->pevent, event_id);
+	if (event)
+		return event->name;
+
+	return "[UNKNOWN EVENT]";
+}
+
+/**
+ * @brief This function allows for an easy access to the tep_record's info
+ *	  streang. The record is read from the file using the offset field of
+ *	  kshark_entry. Be aware that using the kshark_get_X_easy functions can
+ *	  be inefficient if you need an access to more than one of the data
+ *	  fields of the record.
+ *
+ * @param entry: Input location for the KernelShark entry.
+ *
+ * @returns A string showing the data output of the trace event on success,
+ *	    otherwise NULL.
+ */
+const char *kshark_get_info_easy(struct kshark_entry *entry)
+{
+	struct kshark_context *kshark_ctx = NULL;
+	struct event_format *event;
+	struct tep_record *data;
+	const char *info = NULL;
+	int event_id;
+
+	if (!kshark_instance(&kshark_ctx))
+		return NULL;
+
+	data = kshark_read_at(kshark_ctx, entry->offset);
+
+	event_id = tep_data_type(kshark_ctx->pevent, data);
+	event = tep_data_event_from_type(kshark_ctx->pevent, event_id);
+	if (event)
+		info = kshark_get_info(kshark_ctx->pevent, data, event);
+
+	free_record(data);
+
+	return info;
+}
+
 /**
  * @brief Dump into a string the content of one entry. The function allocates
  *	  a null terminated string and returns a pointer to this string. The
diff --git a/kernel-shark-qt/src/libkshark.h b/kernel-shark-qt/src/libkshark.h
index e846c85..f00a584 100644
--- a/kernel-shark-qt/src/libkshark.h
+++ b/kernel-shark-qt/src/libkshark.h
@@ -148,6 +148,18 @@ void kshark_close(struct kshark_context *kshark_ctx);
 
 void kshark_free(struct kshark_context *kshark_ctx);
 
+int kshark_get_pid_easy(struct kshark_entry *entry);
+
+const char *kshark_get_task_easy(struct kshark_entry *entry);
+
+const char *kshark_get_latency_easy(struct kshark_entry *entry);
+
+int kshark_get_event_id_easy(struct kshark_entry *entry);
+
+const char *kshark_get_event_name_easy(struct kshark_entry *entry);
+
+const char *kshark_get_info_easy(struct kshark_entry *entry);
+
 char* kshark_dump_entry(const struct kshark_entry *entry);
 
 struct tep_record *kshark_read_at(struct kshark_context *kshark_ctx,
-- 
2.17.1

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

* [PATCH v3 2/5] kernel-shark-qt: Add kshark_convert_nano() function
  2018-10-05 18:33 [PATCH v3 0/5] Final preparation before adding the KernelShark GUI Yordan Karadzhov
  2018-10-05 18:33 ` [PATCH v3 1/5] kernel-shark-qt: Add kshark_get_X_easy() functions Yordan Karadzhov
@ 2018-10-05 18:33 ` Yordan Karadzhov
  2018-10-05 18:33 ` [PATCH v3 3/5] kernel-shark-qt: Add functions for fast clearing of the filters Yordan Karadzhov
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Yordan Karadzhov @ 2018-10-05 18:33 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>

kshark_convert_nano() is used to convert the original value of the
timestamp of the trace records (having nanosecond precision) into two
values representing the time in seconds and milliseconds.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark-qt/src/libkshark.c | 16 ++++++++++++++++
 kernel-shark-qt/src/libkshark.h |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/kernel-shark-qt/src/libkshark.c b/kernel-shark-qt/src/libkshark.c
index ef577e0..d9d1929 100644
--- a/kernel-shark-qt/src/libkshark.c
+++ b/kernel-shark-qt/src/libkshark.c
@@ -1084,6 +1084,22 @@ const char *kshark_get_info_easy(struct kshark_entry *entry)
 	return info;
 }
 
+/**
+ * @brief Convert the timestamp of the trace record (nanosecond precision) into
+ *	  seconds and microseconds.
+ *
+ * @param time: Input location for the timestamp.
+ * @param sec: Output location for the value of the seconds.
+ * @param usec: Output location for the value of the microseconds.
+ */
+void kshark_convert_nano(uint64_t time, uint64_t *sec, uint64_t *usec)
+{
+	uint64_t s;
+
+	*sec = s = time / 1000000000ULL;
+	*usec = (time - s * 1000000000ULL) / 1000;
+}
+
 /**
  * @brief Dump into a string the content of one entry. The function allocates
  *	  a null terminated string and returns a pointer to this string. The
diff --git a/kernel-shark-qt/src/libkshark.h b/kernel-shark-qt/src/libkshark.h
index f00a584..d24ed8c 100644
--- a/kernel-shark-qt/src/libkshark.h
+++ b/kernel-shark-qt/src/libkshark.h
@@ -160,6 +160,8 @@ const char *kshark_get_event_name_easy(struct kshark_entry *entry);
 
 const char *kshark_get_info_easy(struct kshark_entry *entry);
 
+void kshark_convert_nano(uint64_t time, uint64_t *sec, uint64_t *usec);
+
 char* kshark_dump_entry(const struct kshark_entry *entry);
 
 struct tep_record *kshark_read_at(struct kshark_context *kshark_ctx,
-- 
2.17.1

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

* [PATCH v3 3/5] kernel-shark-qt: Add functions for fast clearing of the filters.
  2018-10-05 18:33 [PATCH v3 0/5] Final preparation before adding the KernelShark GUI Yordan Karadzhov
  2018-10-05 18:33 ` [PATCH v3 1/5] kernel-shark-qt: Add kshark_get_X_easy() functions Yordan Karadzhov
  2018-10-05 18:33 ` [PATCH v3 2/5] kernel-shark-qt: Add kshark_convert_nano() function Yordan Karadzhov
@ 2018-10-05 18:33 ` Yordan Karadzhov
  2018-10-05 18:33 ` [PATCH v3 4/5] kernel-shark-qt: Rename the Cmake-generated header file Yordan Karadzhov
  2018-10-05 18:33 ` [PATCH v3 5/5] kernel-shark-qt: Fix a bug in kshark_data_collection_alloc() Yordan Karadzhov
  4 siblings, 0 replies; 7+ messages in thread
From: Yordan Karadzhov @ 2018-10-05 18:33 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>

The first added function checks if any Id filter is set.

The second added function is used to reset the "visible" field of each
entry to the default value of "0xFF" (visible everywhere).

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark-qt/src/libkshark.c | 28 +++++++++++++++++++++++++++-
 kernel-shark-qt/src/libkshark.h |  6 ++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/kernel-shark-qt/src/libkshark.c b/kernel-shark-qt/src/libkshark.c
index d9d1929..56ae3ce 100644
--- a/kernel-shark-qt/src/libkshark.c
+++ b/kernel-shark-qt/src/libkshark.c
@@ -427,7 +427,14 @@ static bool filter_is_set(struct tracecmd_filter_id *filter)
 	return filter && filter->count;
 }
 
-static bool kshark_filter_is_set(struct kshark_context *kshark_ctx)
+/**
+ * @brief Check if an Id filter is set.
+ *
+ * @param kshark_ctx: Input location for the session context pointer.
+ *
+ * @returns True if at least one Id filter is set, otherwise False.
+ */
+bool kshark_filter_is_set(struct kshark_context *kshark_ctx)
 {
 	return filter_is_set(kshark_ctx->show_task_filter) ||
 	       filter_is_set(kshark_ctx->hide_task_filter) ||
@@ -499,6 +506,25 @@ void kshark_filter_entries(struct kshark_context *kshark_ctx,
 	}
 }
 
+/**
+ * @brief This function loops over the array of entries specified by "data"
+ *	  and "n_entries" and resets the "visible" fields of each entry to
+ *	  the default value of "0xFF" (visible everywhere).
+ *
+ * @param kshark_ctx: Input location for the session context pointer.
+ * @param data: Input location for the trace data to be unfiltered.
+ * @param n_entries: The size of the inputted data.
+ */
+void kshark_clear_all_filters(struct kshark_context *kshark_ctx,
+			      struct kshark_entry **data,
+			      size_t n_entries)
+{
+	int i;
+
+	for (i = 0; i < n_entries; ++i)
+		data[i]->visible = 0xFF;
+}
+
 static void kshark_set_entry_values(struct kshark_context *kshark_ctx,
 				    struct tep_record *record,
 				    struct kshark_entry *entry)
diff --git a/kernel-shark-qt/src/libkshark.h b/kernel-shark-qt/src/libkshark.h
index d24ed8c..a329e08 100644
--- a/kernel-shark-qt/src/libkshark.h
+++ b/kernel-shark-qt/src/libkshark.h
@@ -226,10 +226,16 @@ void kshark_filter_add_id(struct kshark_context *kshark_ctx,
 
 void kshark_filter_clear(struct kshark_context *kshark_ctx, int filter_id);
 
+bool kshark_filter_is_set(struct kshark_context *kshark_ctx);
+
 void kshark_filter_entries(struct kshark_context *kshark_ctx,
 			   struct kshark_entry **data,
 			   size_t n_entries);
 
+void kshark_clear_all_filters(struct kshark_context *kshark_ctx,
+			      struct kshark_entry **data,
+			      size_t n_entries);
+
 /** Search failed identifiers. */
 enum kshark_search_failed {
 	/** All entries have timestamps greater timestamps. */
-- 
2.17.1

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

* [PATCH v3 4/5] kernel-shark-qt: Rename the Cmake-generated header file.
  2018-10-05 18:33 [PATCH v3 0/5] Final preparation before adding the KernelShark GUI Yordan Karadzhov
                   ` (2 preceding siblings ...)
  2018-10-05 18:33 ` [PATCH v3 3/5] kernel-shark-qt: Add functions for fast clearing of the filters Yordan Karadzhov
@ 2018-10-05 18:33 ` Yordan Karadzhov
  2018-10-05 18:33 ` [PATCH v3 5/5] kernel-shark-qt: Fix a bug in kshark_data_collection_alloc() Yordan Karadzhov
  4 siblings, 0 replies; 7+ messages in thread
From: Yordan Karadzhov @ 2018-10-05 18:33 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>

The name of the Cmake-generated header file is changed for "KsDeff.h" to
"KsCmakeDef.hpp" in order to make it more explanatory. With the following
patches the file will start contain C++ declarations.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark-qt/build/cmake_clean.sh | 2 +-
 kernel-shark-qt/build/deff.h.cmake   | 2 +-
 kernel-shark-qt/src/CMakeLists.txt   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel-shark-qt/build/cmake_clean.sh b/kernel-shark-qt/build/cmake_clean.sh
index acdbb43..4f984db 100755
--- a/kernel-shark-qt/build/cmake_clean.sh
+++ b/kernel-shark-qt/build/cmake_clean.sh
@@ -6,6 +6,6 @@ rm -rf CMakeFiles/
 rm -rf src/
 rm -rf examples/
 rm -f ../lib/*
-rm -f ../src/KsDeff.h
+rm -f ../src/KsCmakeDef.hpp
 rm -f CMakeDoxyfile.in
 rm -f CMakeDoxygenDefaults.cmake
diff --git a/kernel-shark-qt/build/deff.h.cmake b/kernel-shark-qt/build/deff.h.cmake
index 111fcdd..44ea08b 100644
--- a/kernel-shark-qt/build/deff.h.cmake
+++ b/kernel-shark-qt/build/deff.h.cmake
@@ -1,5 +1,5 @@
  /**
- *  \file    KsDeff.h
+ *  \file    KsCmakeDef.hpp
  *  \brief   This File is generated by CMAKE
  */
 
diff --git a/kernel-shark-qt/src/CMakeLists.txt b/kernel-shark-qt/src/CMakeLists.txt
index 3365413..305cea7 100644
--- a/kernel-shark-qt/src/CMakeLists.txt
+++ b/kernel-shark-qt/src/CMakeLists.txt
@@ -31,4 +31,4 @@ endif (OPENGL_FOUND AND GLUT_FOUND)
 add_subdirectory(plugins)
 
 configure_file( ${KS_DIR}/build/deff.h.cmake
-                ${KS_DIR}/src/KsDeff.h)
+                ${KS_DIR}/src/KsCmakeDef.hpp)
-- 
2.17.1

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

* [PATCH v3 5/5] kernel-shark-qt: Fix a bug in kshark_data_collection_alloc()
  2018-10-05 18:33 [PATCH v3 0/5] Final preparation before adding the KernelShark GUI Yordan Karadzhov
                   ` (3 preceding siblings ...)
  2018-10-05 18:33 ` [PATCH v3 4/5] kernel-shark-qt: Rename the Cmake-generated header file Yordan Karadzhov
@ 2018-10-05 18:33 ` Yordan Karadzhov
  4 siblings, 0 replies; 7+ messages in thread
From: Yordan Karadzhov @ 2018-10-05 18:33 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov

The margin data added at the end of the data interval of the collection
may actually include the beginning of another interval. Because of this
we have to iterate over the margin data and check for "good" entries. In
the case of a "good" entry being found, we have to continue extending the
last interval.

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark-qt/src/libkshark-collection.c | 27 +++++++++++++++-------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/kernel-shark-qt/src/libkshark-collection.c b/kernel-shark-qt/src/libkshark-collection.c
index 79b6fff..9838042 100644
--- a/kernel-shark-qt/src/libkshark-collection.c
+++ b/kernel-shark-qt/src/libkshark-collection.c
@@ -157,14 +157,25 @@ kshark_data_collection_alloc(struct kshark_context *kshark_ctx,
 			 * number of margin entries requested, keep adding
 			 * until you fill the margin.
 			 */
-			if (i + margin < j)
-				i = j;
-			else
-				i += margin;
-
-			last_added = i;
-			collection_add_entry(&temp, i, COLLECTION_BREAK);
-			++break_count;
+			if (i + margin >= j) {
+				for (;j < i + margin; ++j) {
+					if (cond(kshark_ctx, data[j], val)) {
+						/*
+						 * Good data has been found.
+						 * Continue extending the
+						 * previous data interval.
+						 */
+						good_data = true;
+						break;
+					}
+				}
+			}
+
+			last_added = i = j;
+			if (!good_data) {
+				collection_add_entry(&temp, i, COLLECTION_BREAK);
+				++break_count;
+			}
 		}
 	}
 
-- 
2.17.1

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

* Re: [PATCH v3 1/5] kernel-shark-qt: Add kshark_get_X_easy() functions.
  2018-10-05 18:33 ` [PATCH v3 1/5] kernel-shark-qt: Add kshark_get_X_easy() functions Yordan Karadzhov
@ 2018-10-05 19:20   ` Steven Rostedt
  0 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2018-10-05 19:20 UTC (permalink / raw)
  To: Yordan Karadzhov; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

On Fri, 5 Oct 2018 18:33:20 +0000
Yordan Karadzhov <ykaradzhov@vmware.com> wrote:

> +/**
> + * @brief This function allows for an easy access to the original name of the
> + *	  trace event as recorded in the tep_record object. The record is read
> + *	  from the file only in the case of an entry being touched by a plugin.
> + *	  Be aware that using the kshark_get_X_easy functions can be
> + *	  inefficient if you need an access to more than one of the data fields
> + *	  of the record.
> + *
> + * @param entry: Input location for the KernelShark entry.
> + *
> + * @returns The mane of the trace event recorded in the tep_record object on
> + *	    success, otherwise "[UNKNOWN EVENT]" or NULL.
> + */
> +const char *kshark_get_event_name_easy(struct kshark_entry *entry)
> +{
> +	struct kshark_context *kshark_ctx = NULL;
> +	struct event_format *event;

I had to fix this up as it is now called tep_event_format.

I applied this series and pushed it out. You may want to rebase and do a
make clean on your repo.

Thanks!

-- Steve

> +
> +	int event_id = kshark_get_event_id_easy(entry);
> +
> +	if (event_id < 0)
> +		return NULL;
> +
> +	kshark_instance(&kshark_ctx);
> +	event = tep_data_event_from_type(kshark_ctx->pevent, event_id);
> +	if (event)
> +		return event->name;
> +
> +	return "[UNKNOWN EVENT]";
> +}
> +

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

end of thread, other threads:[~2018-10-06  2:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-05 18:33 [PATCH v3 0/5] Final preparation before adding the KernelShark GUI Yordan Karadzhov
2018-10-05 18:33 ` [PATCH v3 1/5] kernel-shark-qt: Add kshark_get_X_easy() functions Yordan Karadzhov
2018-10-05 19:20   ` Steven Rostedt
2018-10-05 18:33 ` [PATCH v3 2/5] kernel-shark-qt: Add kshark_convert_nano() function Yordan Karadzhov
2018-10-05 18:33 ` [PATCH v3 3/5] kernel-shark-qt: Add functions for fast clearing of the filters Yordan Karadzhov
2018-10-05 18:33 ` [PATCH v3 4/5] kernel-shark-qt: Rename the Cmake-generated header file Yordan Karadzhov
2018-10-05 18:33 ` [PATCH v3 5/5] kernel-shark-qt: Fix a bug in kshark_data_collection_alloc() Yordan Karadzhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.