KernelShark: Add xenomai_cobalt_switch_events plugin for KernelShark
PATCH v2 1/3 KernelShark: Add xenomai_cobalt_switch_events plugin for KernelShark
For Xenomai-cobalt enabled system, cobalt_switch_context means that there is schedule and context switch in companion core(realtime core), which we may need to do special treatment and take correct action as main kernel sched_switch to visualize out-of-band state of realtime tasks running in cobalt core. To achive our target, we implement following:
1. store corresponding cobalt_switch_context events into container data.
2. modify pid stored in entry to be equal to next_pid to show correct color in cpu bar when cobalt_switch_context event happen.
3. show blue hollow box to mark out-of-band state according to cobalt_switch_context events.
4. clickable cobalt_switch_context plugin shapes.
--- tracing/Makefile.am | 6 + tracing/kernelshark/CobaltSwitchEvents.cpp | 156 ++++++++++++++++ tracing/kernelshark/Makefile.am | 18 ++ tracing/kernelshark/README | 75 ++++++++ .../xenomai_cobalt_switch_events.c | 174 ++++++++++++++++++ .../xenomai_cobalt_switch_events.h | 58 ++++++ 6 files changed, 487 insertions(+) create mode 100644 tracing/Makefile.am create mode 100644 tracing/kernelshark/CobaltSwitchEvents.cpp create mode 100644 tracing/kernelshark/Makefile.am create mode 100644 tracing/kernelshark/README create mode 100644 tracing/kernelshark/xenomai_cobalt_switch_events.c create mode 100644 tracing/kernelshark/xenomai_cobalt_switch_events.h
tracing/Makefile.am new file +6 -0
@@ -0,0 +1,6 @@ + +SUBDIRS = \ + kernelshark + +DIST_SUBDIRS = \ + kernelshark
tracing/kernelshark/CobaltSwitchEvents.cpp new file +156 -0
156 lines not on this page · raw message
tracing/kernelshark/Makefile.am new file +18 -0
@@ -0,0 +1,18 @@ + +lib_LTLIBRARIES = libplugin_xenomai_cobalt_switch_events.la + +KS_INCLUDS ?= /usr/local/include/kernelshark +TRACECMD_INCLUDS ?= /usr/local/include/trace-cmd +TRACEFS_INCLUDS ?= /usr/local/include/tracefs +TRACEEVENR_INCLUDS ?= /usr/local/include/traceevent + +libplugin_xenomai_cobalt_switch_events_la_SOURCES = \ + CobaltSwitchEvents.cpp \ + xenomai_cobalt_switch_events.c \ + xenomai_cobalt_switch_events.h + +libplugin_xenomai_cobalt_switch_events_la_CPPFLAGS = \ + -I$(KS_INCLUDS) \ + -I$(TRACECMD_INCLUDS) \ + -I$(TRACEFS_INCLUDS) \ + -I$(TRACEEVENR_INCLUDS)
tracing/kernelshark/README new file +75 -0
75 lines not on this page · raw message
tracing/kernelshark/xenomai_cobalt_switch_events.c new file +174 -0
174 lines not on this page · raw message
tracing/kernelshark/xenomai_cobalt_switch_events.h new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 2/3 Add --with-kernelshark option
option to build kernelshark plugin
--- Makefile.am | 4 ++++ configure.ac | 16 ++++++++++++++++ tracing/Makefile.am | 3 ++- 3 files changed, 22 insertions(+), 1 deletion(-)
Makefile.am +4 -0
@@ -18,6 +18,9 @@ SUBDIRS += \ testsuite endif +SUBDIRS += \ + tracing + EXTRA_DIST = kernel debian DIST_SUBDIRS = \
@@ -26,6 +29,7 @@ DIST_SUBDIRS = \ doc \ include \ lib \ + tracing \ scripts \ testsuite \ utils
configure.ac +16 -0
@@ -826,6 +826,20 @@ AC_ARG_WITH(demodir, ], [XENO_DEMO_DIR=$demodir]) 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]), + [ + case "$withval" in + "" | y | ye | yes) xeno_build_kernelshark=true;; + n | no) xeno_build_kernelshark=false;; + esac + ], [xeno_build_kernelshark=false]) +AC_MSG_RESULT($xeno_build_kernelshark) + +AM_CONDITIONAL([BUILD_KERNELSHARK], [test x$xeno_build_kernelshark = 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)])
@@ -943,6 +957,8 @@ AC_CONFIG_FILES([ \ scripts/Makefile \ scripts/xeno-config:scripts/xeno-config-$rtcore_type.in \ scripts/xeno \ + tracing/Makefile \ + tracing/kernelshark/Makefile \ lib/Makefile \ lib/boilerplate/Makefile \ lib/boilerplate/init/Makefile \
tracing/Makefile.am +2 -1
@@ -1,6 +1,7 @@ - +if BUILD_KERNELSHARK SUBDIRS = \ kernelshark +endif DIST_SUBDIRS = \ kernelshark
Signature · 1 line
2.17.1
Re: [PATCH v2 2/3] Add --with-kernelshark option
Quoted 70 lines · Hongzhan Chen
option to build kernelshark plugin
Signed-off-by Hongzhan Chen <[email protected]>--- Makefile.am | 4 ++++ configure.ac | 16 ++++++++++++++++ tracing/Makefile.am | 3 ++- 3 files changed, 22 insertions(+), 1 deletion(-)Makefile.am +4
-0@@ -18,6 +18,9 @@ SUBDIRS += \ testsuite endif +SUBDIRS += \ + tracing + EXTRA_DIST = kernel debian DIST_SUBDIRS = \@@ -26,6 +29,7 @@ DIST_SUBDIRS = \ doc \ include \ lib \ + tracing \ scripts \ testsuite \ utilsconfigure.ac +16
-0@@ -826,6 +826,20 @@ AC_ARG_WITH(demodir, ], [XENO_DEMO_DIR=$demodir]) 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]), + [ + case "$withval" in + "" | y | ye | yes) xeno_build_kernelshark=true;; + n | no) xeno_build_kernelshark=false;; + esac + ], [xeno_build_kernelshark=false]) +AC_MSG_RESULT($xeno_build_kernelshark) + +AM_CONDITIONAL([BUILD_KERNELSHARK], [test x$xeno_build_kernelshark = 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)])@@ -943,6 +957,8 @@ AC_CONFIG_FILES([ \ scripts/Makefile \ scripts/xeno-config:scripts/xeno-config-$rtcore_type.in \ scripts/xeno \ + tracing/Makefile \ + tracing/kernelshark/Makefile \ lib/Makefile \ lib/boilerplate/Makefile \ lib/boilerplate/init/Makefile \tracing/Makefile.am +0
-0
tracing/Makefile.am line 7
Quoted 8 lines
tracing/Makefile.am +2
-1@@ -1,6 +1,7 @@ - +if BUILD_KERNELSHARK SUBDIRS = \ kernelshark +endif DIST_SUBDIRS = \ kernelshark
Seems you lost the AC_PROG_CXX - things do not build now.
Jan
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux
RE: [PATCH v2 2/3] Add --with-kernelshark option
Quoted 19 lines
Quoted 19 lines
configure.ac +2
-0+ tracing/Makefile \ + tracing/kernelshark/Makefile \ lib/Makefile \ lib/boilerplate/Makefile \ lib/boilerplate/init/Makefile \tracing/Makefile.am +2
-1@@ -1,6 +1,7 @@ - +if BUILD_KERNELSHARK SUBDIRS = \ kernelshark +endif
Quoted 4 lines
tracing/Makefile.am line 7
Quoted 2 lines
tracing/Makefile.am +0
-0DIST_SUBDIRS = \ kernelsharkSeems you lost the
AC_PROG_CXX- things do not build now.
Sorry, I assumed that patch [1] pass review , so I have not committed again to review. Could you apply this patch?
https://xenomai.org/pipermail/xenomai/2022-February/047262.html
Regards
Hongzhan Chen
Quoted 10 lines
Jan
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux
Re: [PATCH v2 2/3] Add --with-kernelshark option
Quoted 24 lines · Hongzhan
Quoted 19 lines
Quoted 19 lines
configure.ac +2
-0+ tracing/Makefile \ + tracing/kernelshark/Makefile \ lib/Makefile \ lib/boilerplate/Makefile \ lib/boilerplate/init/Makefile \tracing/Makefile.am +2
-1@@ -1,6 +1,7 @@ - +if BUILD_KERNELSHARK SUBDIRS = \ kernelshark +endifQuoted 4 lines
tracing/Makefile.am line 7
Quoted 2 lines
tracing/Makefile.am +0
-0DIST_SUBDIRS = \ kernelsharkSeems you lost the
AC_PROG_CXX- things do not build now.
Quoted 5 lines
Sorry, I assumed that patch [1] pass review , so I have not committed again to review. Could you apply this patch?
https://xenomai.org/pipermail/xenomai/2022-February/047262.html
When sending v4 after my review remarks, please include all patches.
Jan
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux
RE: [PATCH v2 2/3] Add --with-kernelshark option
Quoted 33 lines
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, March 3, 2022 2:39 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH v2 2/3] Add --with-kernelshark optionQuoted 24 lines · Hongzhan
Quoted 23 lines
Quoted 13 lines
configure.ac +2
-0+ tracing/Makefile \ + tracing/kernelshark/Makefile \ lib/Makefile \ lib/boilerplate/Makefile \ lib/boilerplate/init/Makefile \tracing/Makefile.am +0
-0tracing/Makefile.am line 7
Quoted 8 lines
tracing/Makefile.am +2
-1@@ -1,6 +1,7 @@ - +if BUILD_KERNELSHARK SUBDIRS = \ kernelshark +endif DIST_SUBDIRS = \ kernelsharkSeems you lost the
AC_PROG_CXX- things do not build now.
Quoted 7 lines
Quoted 5 lines
Sorry, I assumed that patch [1] pass review , so I have not committed again to review. Could you apply this patch?
https://xenomai.org/pipermail/xenomai/2022-February/047262.html
When sending v4 after my review remarks, please include all patches.
If it already pass review , why cannot we merge it at first?
Regards
Hongzhan Chen
Quoted 7 lines
Jan
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux
Re: [PATCH v2 2/3] Add --with-kernelshark option
Quoted 36 lines · Hongzhan
Quoted 36 lines
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: Thursday, March 3, 2022 2:39 PM
To: Chen, Hongzhan <[email protected]>; [email protected]
Subject: Re: [PATCH v2 2/3] Add --with-kernelshark optionQuoted 27 lines · Hongzhan
Quoted 19 lines
Quoted 19 lines
configure.ac +2
-0+ tracing/Makefile \ + tracing/kernelshark/Makefile \ lib/Makefile \ lib/boilerplate/Makefile \ lib/boilerplate/init/Makefile \tracing/Makefile.am +2
-1@@ -1,6 +1,7 @@ - +if BUILD_KERNELSHARK SUBDIRS = \ kernelshark +endifQuoted 4 lines
tracing/Makefile.am line 7
Quoted 2 lines
tracing/Makefile.am +0
-0DIST_SUBDIRS = \ kernelsharkSeems you lost the
AC_PROG_CXX- things do not build now.Sorry, I assumed that patch [1] pass review , so I have not committed again to review. Could you apply this patch?
Quoted 7 lines
Quoted 4 lines
When sending v4 after my review remarks, please include all patches.
If it already pass review , why cannot we merge it at first?
It belongs logically to the kernelshark/libtraceevent series and is not needed otherwise.
Jan
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux
PATCH v2 3/3 libtraceevent: Add xenomai_schedparams plugin for libtraceevent
In reply to Hongzhan ChenFor 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 | 10 + tracing/libtraceevent/README | 30 +++ .../plugin_xenomai_schedparams.c | 201 ++++++++++++++++++ 5 files changed, 268 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
@@ -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
@@ -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 +10 -0
@@ -0,0 +1,10 @@ + +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)
tracing/libtraceevent/README new file +30 -0
@@ -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 +201 -0
201 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v2 3/3] libtraceevent: Add xenomai_schedparams plugin for libtraceevent
Quoted 184 lines · Hongzhan Chen via Xenomai
For cobalt thread, there is special struct
param_exdata stored in data record, we need to parse and print its content out correctly to hint user.Signed-off-by Hongzhan Chen <[email protected]>--- configure.ac | 17 +- tracing/Makefile.am | 13 +- tracing/libtraceevent/Makefile.am | 10 + tracing/libtraceevent/README | 30 +++ .../plugin_xenomai_schedparams.c | 201 ++++++++++++++++++ 5 files changed, 268 insertions(+), 3 deletions(-) create mode 100644 tracing/libtraceevent/Makefile.am create mode 100644 tracing/libtraceevent/README create mode 100644 tracing/libtraceevent/plugin_xenomai_schedparams.cconfigure.ac +16
-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]), [ 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@@ -1,7 +1,16 @@ if BUILD_KERNELSHARK SUBDIRS = \ - kernelshark + kernelshark \ + libtraceevent +else + +if BUILD_LIBTRACEEVENT +SUBDIRS = \ + libtraceevent +endif + endif DIST_SUBDIRS = \ - kernelshark + kernelshark \ + libtraceeventtracing/libtraceevent/Makefile.am new file +10
-0@@ -0,0 +1,10 @@ + +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)tracing/libtraceevent/README new file +30
-0@@ -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 +45
-0@@ -0,0 +1,201 @@ +// SPDX-License-Identifier: LGPL-2.1 +/* +* Copyright (C) 2021 Intel Inc, Hongzhan Chen <[email protected]> +*/ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <linux/sched.h> + +#include "event-parse.h" +#include "trace-seq.h" + + +#define SCHED_SPORADIC 10 +#define SCHED_TP 11 +#define SCHED_QUOTA 12 + +#define SCHED_COBALT 42 +#define SCHED_WEAK 43 + +struct __sched_ss_param { +int __sched_low_priority; +struct timespec __sched_repl_period; +struct timespec __sched_init_budget; +int __sched_max_repl; +}; + +struct __sched_rr_param { +struct timespec __sched_rr_quantum; +}; + +struct __sched_tp_param { +int __sched_partition; +}; + +struct __sched_quota_param { +int __sched_group; +}; + +struct sched_param_ex { +int sched_priority; +union { +struct __sched_ss_param ss; +struct __sched_rr_param rr; +struct __sched_tp_param tp;
tracing/libtraceevent/plugin_xenomai_schedparams.c line 55
Quoted 10 lines
tracing/libtraceevent/plugin_xenomai_schedparams.c new file +10
-0+struct __sched_quota_param quota; + } sched_u; +}; + +#define sched_quota_group sched_u.quota.__sched_group +#define sched_tp_partition sched_u.tp.__sched_partition +#define sched_ss_low_priority sched_u.ss.__sched_low_priority +#define sched_ss_repl_period sched_u.ss.__sched_repl_period +#define sched_ss_init_budget sched_u.ss.__sched_init_budget +#define sched_ss_max_repl sched_u.ss.__sched_max_repl
Why can't you include the xenomai header that actually already defines such types and their helpers? I might overlook something, but it looks like a redefinition to me which might break as soon as we have to touch such types inside Xenomai. Everything around sched_param_ex is y2038 affected for example, so there might be the need to change...
Quoted 146 lines
tracing/libtraceevent/plugin_xenomai_schedparams.c new file +146
-0+ +static void write_policy (struct trace_seq *p,int policy) +{ +trace_seq_printf (p,"policy=" ); + +switch (policy) { +case SCHED_QUOTA : +trace_seq_printf (p,"quota " ); +break ; +case SCHED_TP : +trace_seq_printf (p,"tp " ); +break ; +case SCHED_NORMAL : +trace_seq_printf (p,"normal " ); +break ; +case SCHED_SPORADIC : +trace_seq_printf (p,"sporadic " ); +break ; +case SCHED_RR : +trace_seq_printf (p,"rr " ); +break ; +case SCHED_FIFO : +trace_seq_printf (p,"fifo " ); +break ; +case SCHED_COBALT : +trace_seq_printf (p,"cobalt " ); +break ; +case SCHED_WEAK : +trace_seq_printf (p,"weak " ); +break ; +default : +trace_seq_printf (p,"unknown " ); +break ; + } +} + +/* save param */ +static void write_param (struct tep_format_field *field, +struct tep_record *record, +struct trace_seq *p,int policy) +{ +int offset; +struct sched_param_ex *params; + + offset = field->offset; + +if (!strncmp (field->type,"__data_loc" ,10 )) { +unsigned long long v; + +if (tep_read_number_field (field, record->data, &v)) { +trace_seq_printf (p,"invalid_data_loc" ); +return ; + } + offset = v &0xffff ; + + } + + params = (struct sched_param_ex *)((char *)record->data + offset); + +trace_seq_printf (p,"param: { " ); + +switch (policy) { +case SCHED_QUOTA : +trace_seq_printf (p,"priority=%d, group=%d" , + params->sched_priority, + params->sched_quota_group); +break ; +case SCHED_TP : +trace_seq_printf (p,"priority=%d, partition=%d" , + params->sched_priority, + params->sched_tp_partition); +break ; +case SCHED_NORMAL : +break ; +case SCHED_SPORADIC : +trace_seq_printf (p,"priority=%d, low_priority=%d, " , + params->sched_priority, + params->sched_ss_low_priority); + +trace_seq_printf (p,"budget=(%ld.%09ld), period=(%ld.%09ld), " , + params->sched_ss_init_budget.tv_sec, + params->sched_ss_init_budget.tv_nsec); + +trace_seq_printf (p,"maxrepl=%d" , + params->sched_ss_max_repl); +break ; +case SCHED_RR : +case SCHED_FIFO : +case SCHED_COBALT : +case SCHED_WEAK : +default : +trace_seq_printf (p,"priority=%d" , params->sched_priority); +break ; + } +trace_seq_printf (p," }" ); +trace_seq_putc (p,'\0' ); + +} + +static int cobalt_schedparam_handler (struct trace_seq *s, +struct tep_record *record, +struct tep_event *event,void *context) +{ +struct tep_format_field *field; +unsigned long long val; + +if (tep_get_field_val (s, event,"pth" , record, &val,1 )) +return trace_seq_putc (s,'!' ); +trace_seq_puts (s,"pth: " ); +trace_seq_printf (s,"0x%08llx " , val); + +if (tep_get_field_val (s, event,"policy" , record, &val,1 ) ==0 ) +write_policy (s, val); + + field =tep_find_field (event,"param_ex" ); +if (field) +write_param (field, record, s, val); + +return 0 ; +} + +int TEP_PLUGIN_LOADER (struct tep_handle *tep) +{ +tep_register_event_handler (tep,-1 ,"cobalt_posix" ,"cobalt_pthread_setschedparam" , + cobalt_schedparam_handler,NULL ); + +tep_register_event_handler (tep,-1 ,"cobalt_posix" ,"cobalt_pthread_getschedparam" , + cobalt_schedparam_handler,NULL ); + +tep_register_event_handler (tep,-1 ,"cobalt_posix" ,"cobalt_pthread_create" , + cobalt_schedparam_handler,NULL ); + +return 0 ; +} + +void TEP_PLUGIN_UNLOADER (struct tep_handle *tep) +{ +tep_unregister_event_handler (tep,-1 ,"cobalt_posix" ,"cobalt_pthread_setschedparam" , + cobalt_schedparam_handler,NULL ); + +tep_unregister_event_handler (tep,-1 ,"cobalt_posix" ,"cobalt_pthread_getschedparam" , + cobalt_schedparam_handler,NULL ); + +tep_unregister_event_handler (tep,-1 ,"cobalt_posix" ,"cobalt_pthread_create" , + cobalt_schedparam_handler,NULL ); +}
Quoted 32 lines · Hongzhan Chen
For Xenomai-cobalt enabled system,
cobalt_switch_contextmeans that there is schedule and context switch in companion core(realtime core), which we may need to do special treatment and take correct action as main kernelsched_switchto visualize out-of-band state of realtime tasks running in cobalt core. To achive our target, we implement following:1. store corresponding
cobalt_switch_contextevents into container data.
2. modify pid stored in entry to be equal tonext_pidto show correct color in cpu bar whencobalt_switch_contextevent happen.
3. show blue hollow box to mark out-of-band state according tocobalt_switch_contextevents.
4. clickablecobalt_switch_contextplugin shapes.Signed-off-by Hongzhan Chen <[email protected]>--- tracing/Makefile.am | 6 + tracing/kernelshark/CobaltSwitchEvents.cpp | 156 ++++++++++++++++ tracing/kernelshark/Makefile.am | 18 ++ tracing/kernelshark/README | 75 ++++++++ .../xenomai_cobalt_switch_events.c | 174 ++++++++++++++++++ .../xenomai_cobalt_switch_events.h | 58 ++++++ 6 files changed, 487 insertions(+) create mode 100644 tracing/Makefile.am create mode 100644 tracing/kernelshark/CobaltSwitchEvents.cpp create mode 100644 tracing/kernelshark/Makefile.am create mode 100644 tracing/kernelshark/README create mode 100644 tracing/kernelshark/xenomai_cobalt_switch_events.c create mode 100644 tracing/kernelshark/xenomai_cobalt_switch_events.h
...
tracing/kernelshark/Makefile.am line 7
Quoted 13 lines
tracing/kernelshark/Makefile.am new file +7
-0@@ -0,0 +1,18 @@ + +lib_LTLIBRARIES = libplugin_xenomai_cobalt_switch_events.la + +KS_INCLUDS ?= /usr/local/include/kernelshark +TRACECMD_INCLUDS ?= /usr/local/include/trace-cmd +TRACEFS_INCLUDS ?= /usr/local/include/tracefs +TRACEEVENR_INCLUDS ?= /usr/local/include/traceevent
configure.ac needs to gain a way to make this configurable (kernelshark and libtraceevent folders). And then you can also drop these defaults.
Jan
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux
Quoted 36 lines · Jan Kiszka via Xenomai
Quoted 32 lines · Hongzhan Chen
For Xenomai-cobalt enabled system,
cobalt_switch_contextmeans that there is schedule and context switch in companion core(realtime core), which we may need to do special treatment and take correct action as main kernelsched_switchto visualize out-of-band state of realtime tasks running in cobalt core. To achive our target, we implement following:1. store corresponding
cobalt_switch_contextevents into container data.
2. modify pid stored in entry to be equal tonext_pidto show correct color in cpu bar whencobalt_switch_contextevent happen.
3. show blue hollow box to mark out-of-band state according tocobalt_switch_contextevents.
4. clickablecobalt_switch_contextplugin shapes.Signed-off-by Hongzhan Chen <[email protected]>--- tracing/Makefile.am | 6 + tracing/kernelshark/CobaltSwitchEvents.cpp | 156 ++++++++++++++++ tracing/kernelshark/Makefile.am | 18 ++ tracing/kernelshark/README | 75 ++++++++ .../xenomai_cobalt_switch_events.c | 174 ++++++++++++++++++ .../xenomai_cobalt_switch_events.h | 58 ++++++ 6 files changed, 487 insertions(+) create mode 100644 tracing/Makefile.am create mode 100644 tracing/kernelshark/CobaltSwitchEvents.cpp create mode 100644 tracing/kernelshark/Makefile.am create mode 100644 tracing/kernelshark/README create mode 100644 tracing/kernelshark/xenomai_cobalt_switch_events.c create mode 100644 tracing/kernelshark/xenomai_cobalt_switch_events.h...
Quoted 17 lines
tracing/kernelshark/Makefile.am line 7
Quoted 13 lines
tracing/kernelshark/Makefile.am new file +7
-0@@ -0,0 +1,18 @@ + +lib_LTLIBRARIES = libplugin_xenomai_cobalt_switch_events.la + +KS_INCLUDS ?= /usr/local/include/kernelshark +TRACECMD_INCLUDS ?= /usr/local/include/trace-cmd +TRACEFS_INCLUDS ?= /usr/local/include/tracefs +TRACEEVENR_INCLUDS ?= /usr/local/include/traceeventconfigure.ac needs to gain a way to make this configurable (kernelshark and libtraceevent folders). And then you can also drop these defaults.
Use case: Local installation of self-built kernelshark/libtraceevent under uncommon paths. Allows to test new versions of them without uninstalling an existing one, maybe even a distro package.
Jan
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux