Skip to contentSkip to conversation

libtraceevent: Add xenomai_schedparams plugin for libtraceevent

PATCH In review Hongzhan Chen 2 participants 5 messages Mar 3, 2022 – Mar 4, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 libtraceevent: Add xenomai_schedparams plugin for libtraceevent

For cobalt thread, there is special struct param_ex data stored in data record, we need to parse and print its content out correctly to hint user.

---
 configure.ac                                  |  17 +-
 tracing/Makefile.am                           |  13 +-
 tracing/libtraceevent/Makefile.am             |  11 ++
 tracing/libtraceevent/README                  |  30 ++++
 .../plugin_xenomai_schedparams.c              | 158 ++++++++++++++++++
 5 files changed, 226 insertions(+), 3 deletions(-)
 create mode 100644 tracing/libtraceevent/Makefile.am
 create mode 100644 tracing/libtraceevent/README
 create mode 100644 tracing/libtraceevent/plugin_xenomai_schedparams.c
configure.ac +16 -1
index b8e9ca143..5858b3b22 100644
@@ -829,7 +829,7 @@ AC_MSG_RESULT($XENO_DEMO_DIR)
 xeno_build_kernelshark=false
 AC_MSG_CHECKING(build kernelshark plugins)
 AC_ARG_WITH(kernelshark,
-    AS_HELP_STRING([--with-kernelshark],[build kernelshark related plugins]),
+    AS_HELP_STRING([--with-kernelshark],[build kernelshark related plugins including libtraceevent plugin]),
     [
 	case "$withval" in
 	"" | y | ye | yes) xeno_build_kernelshark=true;;
@@ -840,6 +840,20 @@ AC_MSG_RESULT($xeno_build_kernelshark)
 
 AM_CONDITIONAL([BUILD_KERNELSHARK], [test x$xeno_build_kernelshark = xtrue])
 
+xeno_build_libtraceevent=false
+AC_MSG_CHECKING(build libtraceevent plugin)
+AC_ARG_WITH(libtraceevent,
+    AS_HELP_STRING([--with-libtraceevent],[build libtraceevent plugin]),
+    [
+	case "$withval" in
+	"" | y | ye | yes) xeno_build_libtraceevent=true;;
+	n | no) xeno_build_libtraceevent=false;;
+	esac
+    ], [xeno_build_libtraceevent=false])
+AC_MSG_RESULT($xeno_build_libtraceevent)
+
+AM_CONDITIONAL([BUILD_LIBTRACEEVENT], [test x$xeno_build_libtraceevent = xtrue])
+
 AC_MSG_CHECKING([for test source generation])
 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
     [AC_MSG_RESULT(ok)], [AC_MSG_RESULT(failed)], [AC_MSG_RESULT(untestable)])
@@ -959,6 +973,7 @@ AC_CONFIG_FILES([ \
 	scripts/xeno \
 	tracing/Makefile \
 	tracing/kernelshark/Makefile \
+	tracing/libtraceevent/Makefile \
 	lib/Makefile \
 	lib/boilerplate/Makefile \
 	lib/boilerplate/init/Makefile \
tracing/Makefile.am +11 -2
index 7925ae9c6..1351a98d2 100644
@@ -1,7 +1,16 @@
 if BUILD_KERNELSHARK
 SUBDIRS =		\
-	kernelshark
+	kernelshark	\
+	libtraceevent
+else
+
+if BUILD_LIBTRACEEVENT
+SUBDIRS =		\
+	libtraceevent
+endif
+
 endif
 
 DIST_SUBDIRS = 		\
-	kernelshark
+	kernelshark	\
+	libtraceevent
tracing/libtraceevent/Makefile.am new file +11 -0
new file mode 100644
index 000000000..3a5345feb
@@ -0,0 +1,11 @@
+
+lib_LTLIBRARIES = libplugin_xenomai_schedparams.la
+
+TRACEEVENR_INCLUDS ?= /usr/local/include/traceevent
+
+libplugin_xenomai_schedparams_la_SOURCES =	\
+	plugin_xenomai_schedparams.c
+
+libplugin_xenomai_schedparams_la_CPPFLAGS =	\
+	-I$(TRACEEVENR_INCLUDS)			\
+	-I$(top_srcdir)/include
tracing/libtraceevent/README new file +30 -0
new file mode 100644
index 000000000..c15088b02
@@ -0,0 +1,30 @@
+
+What is it?
+=============
+
+  It is Xenomai plugin on libtracevent to parse struct param_ex
+  out correctly for trace log.
+
+How to compile?
+================================
+
+Preparation:
+
+  - GIT clone:
+
+      https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git
+
+  - build and install libtraceevent:
+
+      make;
+      sudo make install
+
+How to use built lib?
+===============================
+
+  Please copy built libplugin_xenomai_schedparams.so to
+  /usr/local/lib/traceevent/plugins/ or
+  /usr/local/lib64/traceevent/plugins/ depending on your system.
+  While libtracevent and its plugins is installed correctly, the plugins
+  would be loaded automatically by other module such as libtracecmd after
+  corresponding tracing tool run such as kernelshark or tracecmd.
tracing/libtraceevent/plugin_xenomai_schedparams.c new file +158 -0

158 lines not on this page · raw message

Signature · 1 line
2.17.1
#1 lore raw
Quoted 21 lines · Hongzhan Chen

For cobalt thread, there is special struct param_ex data stored in data record, we need to parse and print its content out correctly to hint user.

---
 configure.ac                                  |  17 +-
 tracing/Makefile.am                           |  13 +-
 tracing/libtraceevent/Makefile.am             |  11 ++
 tracing/libtraceevent/README                  |  30 ++++
 .../plugin_xenomai_schedparams.c              | 158 ++++++++++++++++++
 5 files changed, 226 insertions(+), 3 deletions(-)
 create mode 100644 tracing/libtraceevent/Makefile.am
 create mode 100644 tracing/libtraceevent/README
 create mode 100644 tracing/libtraceevent/plugin_xenomai_schedparams.c
configure.ac +0 -0
index b8e9ca143..5858b3b22 100644

configure.ac AC_MSG_RESULT($XENO_DEMO_DIR) · line 832

Quoted 5 lines
configure.ac +1 -1
@@ -829,7 +829,7 @@ AC_MSG_RESULT($XENO_DEMO_DIR)
 xeno_build_kernelshark=false
 AC_MSG_CHECKING(build kernelshark plugins)
 AC_ARG_WITH(kernelshark,
-    AS_HELP_STRING([--with-kernelshark],[build kernelshark related plugins]),
+    AS_HELP_STRING([--with-kernelshark],[build kernelshark related plugins including libtraceevent plugin]),

Try to refactor in way that you do not needlessly modify code that you added in a previous patch of the same series.

Quoted 39 lines
configure.ac +15 -0
     [
 	case "$withval" in
 	"" | y | ye | yes) xeno_build_kernelshark=true;;
@@ -840,6 +840,20 @@ AC_MSG_RESULT($xeno_build_kernelshark)
 
 AM_CONDITIONAL([BUILD_KERNELSHARK], [test x$xeno_build_kernelshark = xtrue])
 
+xeno_build_libtraceevent=false
+AC_MSG_CHECKING(build libtraceevent plugin)
+AC_ARG_WITH(libtraceevent,
+    AS_HELP_STRING([--with-libtraceevent],[build libtraceevent plugin]),
+    [
+	case "$withval" in
+	"" | y | ye | yes) xeno_build_libtraceevent=true;;
+	n | no) xeno_build_libtraceevent=false;;
+	esac
+    ], [xeno_build_libtraceevent=false])
+AC_MSG_RESULT($xeno_build_libtraceevent)
+
+AM_CONDITIONAL([BUILD_LIBTRACEEVENT], [test x$xeno_build_libtraceevent = xtrue])
+
 AC_MSG_CHECKING([for test source generation])
 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
     [AC_MSG_RESULT(ok)], [AC_MSG_RESULT(failed)], [AC_MSG_RESULT(untestable)])
@@ -959,6 +973,7 @@ AC_CONFIG_FILES([ \
 	scripts/xeno \
 	tracing/Makefile \
 	tracing/kernelshark/Makefile \
+	tracing/libtraceevent/Makefile \
 	lib/Makefile \
 	lib/boilerplate/Makefile \
 	lib/boilerplate/init/Makefile \
tracing/Makefile.am +0 -0
index 7925ae9c6..1351a98d2 100644
@@ -1,7 +1,16 @@
 if BUILD_KERNELSHARK
 SUBDIRS =		\

tracing/Makefile.am line 11

Quoted 10 lines
tracing/Makefile.am +9 -1
-	kernelshark
+	kernelshark	\
+	libtraceevent
+else
+
+if BUILD_LIBTRACEEVENT
+SUBDIRS =		\
+	libtraceevent
+endif
+

You want SUBDIRS += ...

See existing makefiles.

Jan

Signature · 2 lines
Siemens AG, Technology
Competence Center Embedded Linux
#2 lore raw
Quoted 83 lines · Jan Kiszka via Xenomai
Quoted 21 lines · Hongzhan Chen

For cobalt thread, there is special struct param_ex data stored in data record, we need to parse and print its content out correctly to hint user.

---
 configure.ac                                  |  17 +-
 tracing/Makefile.am                           |  13 +-
 tracing/libtraceevent/Makefile.am             |  11 ++
 tracing/libtraceevent/README                  |  30 ++++
 .../plugin_xenomai_schedparams.c              | 158 ++++++++++++++++++
 5 files changed, 226 insertions(+), 3 deletions(-)
 create mode 100644 tracing/libtraceevent/Makefile.am
 create mode 100644 tracing/libtraceevent/README
 create mode 100644 tracing/libtraceevent/plugin_xenomai_schedparams.c
configure.ac +0 -0
index b8e9ca143..5858b3b22 100644

configure.ac AC_MSG_RESULT($XENO_DEMO_DIR) · line 832

Quoted 5 lines
configure.ac +1 -1
@@ -829,7 +829,7 @@ AC_MSG_RESULT($XENO_DEMO_DIR)
 xeno_build_kernelshark=false
 AC_MSG_CHECKING(build kernelshark plugins)
 AC_ARG_WITH(kernelshark,
-    AS_HELP_STRING([--with-kernelshark],[build kernelshark related plugins]),
+    AS_HELP_STRING([--with-kernelshark],[build kernelshark related plugins including libtraceevent plugin]),

Try to refactor in way that you do not needlessly modify code that you added in a previous patch of the same series.

Quoted 39 lines
configure.ac +15 -0
     [
 	case "$withval" in
 	"" | y | ye | yes) xeno_build_kernelshark=true;;
@@ -840,6 +840,20 @@ AC_MSG_RESULT($xeno_build_kernelshark)
 
 AM_CONDITIONAL([BUILD_KERNELSHARK], [test x$xeno_build_kernelshark = xtrue])
 
+xeno_build_libtraceevent=false
+AC_MSG_CHECKING(build libtraceevent plugin)
+AC_ARG_WITH(libtraceevent,
+    AS_HELP_STRING([--with-libtraceevent],[build libtraceevent plugin]),
+    [
+	case "$withval" in
+	"" | y | ye | yes) xeno_build_libtraceevent=true;;
+	n | no) xeno_build_libtraceevent=false;;
+	esac
+    ], [xeno_build_libtraceevent=false])
+AC_MSG_RESULT($xeno_build_libtraceevent)
+
+AM_CONDITIONAL([BUILD_LIBTRACEEVENT], [test x$xeno_build_libtraceevent = xtrue])
+
 AC_MSG_CHECKING([for test source generation])
 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
     [AC_MSG_RESULT(ok)], [AC_MSG_RESULT(failed)], [AC_MSG_RESULT(untestable)])
@@ -959,6 +973,7 @@ AC_CONFIG_FILES([ \
 	scripts/xeno \
 	tracing/Makefile \
 	tracing/kernelshark/Makefile \
+	tracing/libtraceevent/Makefile \
 	lib/Makefile \
 	lib/boilerplate/Makefile \
 	lib/boilerplate/init/Makefile \
tracing/Makefile.am +0 -0
index 7925ae9c6..1351a98d2 100644
@@ -1,7 +1,16 @@
 if BUILD_KERNELSHARK
 SUBDIRS =		\

tracing/Makefile.am line 11

Quoted 10 lines
tracing/Makefile.am +9 -1
-	kernelshark
+	kernelshark	\
+	libtraceevent
+else
+
+if BUILD_LIBTRACEEVENT
+SUBDIRS =		\
+	libtraceevent
+endif
+

You want SUBDIRS += ...

Quoted 2 lines

See existing makefiles.

Oh, and I don't think that the kernelshark plugin technically depends on the libtraceevent one. Both can be and are controlled via configure independently, though you normally /want/ libtraceevent as well when using the kernelshark plugin.

Jan

Signature · 2 lines
Siemens AG, Technology
Competence Center Embedded Linux
#3 lore raw
Quoted 92 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, March 3, 2022 3:01 PM
To: Chen, Hongzhan <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH v3] libtraceevent: Add xenomai_schedparams plugin for libtraceevent

Quoted 83 lines · Jan Kiszka via Xenomai
Quoted 21 lines · Hongzhan Chen

For cobalt thread, there is special struct param_ex data stored in data record, we need to parse and print its content out correctly to hint user.

---
 configure.ac                                  |  17 +-
 tracing/Makefile.am                           |  13 +-
 tracing/libtraceevent/Makefile.am             |  11 ++
 tracing/libtraceevent/README                  |  30 ++++
 .../plugin_xenomai_schedparams.c              | 158 ++++++++++++++++++
 5 files changed, 226 insertions(+), 3 deletions(-)
 create mode 100644 tracing/libtraceevent/Makefile.am
 create mode 100644 tracing/libtraceevent/README
 create mode 100644 tracing/libtraceevent/plugin_xenomai_schedparams.c
configure.ac +0 -0
index b8e9ca143..5858b3b22 100644

configure.ac AC_MSG_RESULT($XENO_DEMO_DIR) · line 832

Quoted 5 lines
configure.ac +1 -1
@@ -829,7 +829,7 @@ AC_MSG_RESULT($XENO_DEMO_DIR)
 xeno_build_kernelshark=false
 AC_MSG_CHECKING(build kernelshark plugins)
 AC_ARG_WITH(kernelshark,
-    AS_HELP_STRING([--with-kernelshark],[build kernelshark related plugins]),
+    AS_HELP_STRING([--with-kernelshark],[build kernelshark related plugins including libtraceevent plugin]),

Try to refactor in way that you do not needlessly modify code that you added in a previous patch of the same series.

Quoted 39 lines
configure.ac +15 -0
     [
 	case "$withval" in
 	"" | y | ye | yes) xeno_build_kernelshark=true;;
@@ -840,6 +840,20 @@ AC_MSG_RESULT($xeno_build_kernelshark)
 
 AM_CONDITIONAL([BUILD_KERNELSHARK], [test x$xeno_build_kernelshark = xtrue])
 
+xeno_build_libtraceevent=false
+AC_MSG_CHECKING(build libtraceevent plugin)
+AC_ARG_WITH(libtraceevent,
+    AS_HELP_STRING([--with-libtraceevent],[build libtraceevent plugin]),
+    [
+	case "$withval" in
+	"" | y | ye | yes) xeno_build_libtraceevent=true;;
+	n | no) xeno_build_libtraceevent=false;;
+	esac
+    ], [xeno_build_libtraceevent=false])
+AC_MSG_RESULT($xeno_build_libtraceevent)
+
+AM_CONDITIONAL([BUILD_LIBTRACEEVENT], [test x$xeno_build_libtraceevent = xtrue])
+
 AC_MSG_CHECKING([for test source generation])
 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
     [AC_MSG_RESULT(ok)], [AC_MSG_RESULT(failed)], [AC_MSG_RESULT(untestable)])
@@ -959,6 +973,7 @@ AC_CONFIG_FILES([ \
 	scripts/xeno \
 	tracing/Makefile \
 	tracing/kernelshark/Makefile \
+	tracing/libtraceevent/Makefile \
 	lib/Makefile \
 	lib/boilerplate/Makefile \
 	lib/boilerplate/init/Makefile \
tracing/Makefile.am +0 -0
index 7925ae9c6..1351a98d2 100644
@@ -1,7 +1,16 @@
 if BUILD_KERNELSHARK
 SUBDIRS =		\

tracing/Makefile.am line 11

Quoted 10 lines
tracing/Makefile.am +9 -1
-	kernelshark
+	kernelshark	\
+	libtraceevent
+else
+
+if BUILD_LIBTRACEEVENT
+SUBDIRS =		\
+	libtraceevent
+endif
+

You want SUBDIRS += ...

Quoted 4 lines
Quoted 2 lines

See existing makefiles.

Oh, and I don't think that the kernelshark plugin technically depends on

If we remove include path TRACEEVENR_INCLUDS ?= /usr/local/include/traceevent
in plugin Makefile.am, it report following error:
/usr/local/include/trace-cmd/trace-cmd.h:9:10: fatal error: event-parse.h: No such file or directory
9 | #include "event-parse.h"

It definely depends on libtraceevent one.

Regards

Hongzhan Chen

Quoted 10 lines

the libtraceevent one. Both can be and are controlled via configure independently, though you normally /want/ libtraceevent as well when using the kernelshark plugin.

Jan

Signature · 2 lines
Siemens AG, Technology
Competence Center Embedded Linux
#4 lore raw
Quoted 26 lines
Quoted 26 lines

-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, March 3, 2022 3:01 PM
To: Chen, Hongzhan <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH v3] libtraceevent: Add xenomai_schedparams plugin for libtraceevent

Quoted 13 lines

tracing/Makefile.am line 11

Quoted 8 lines
tracing/Makefile.am +8 -0
+	libtraceevent
+else
+
+if BUILD_LIBTRACEEVENT
+SUBDIRS =		\
+	libtraceevent
+endif
+

You want SUBDIRS += ...

See existing makefiles.

Quoted 8 lines
Quoted 1 line

Oh, and I don't think that the kernelshark plugin technically depends on

If we remove include path TRACEEVENR_INCLUDS ?= /usr/local/include/traceevent
in plugin Makefile.am, it report following error:
/usr/local/include/trace-cmd/trace-cmd.h:9:10: fatal error: event-parse.h: No such file or directory
9 | #include "event-parse.h"

It definely depends on libtraceevent one.

I will remove the dependency between two plugins in V4.

Regards

Hongzhan Chen

Quoted 14 lines

Regards

Hongzhan Chen

Quoted 9 lines

the libtraceevent one. Both can be and are controlled via configure independently, though you normally /want/ libtraceevent as well when using the kernelshark plugin.

Jan

Signature · 2 lines
Siemens AG, Technology
Competence Center Embedded Linux