diff options
author | kalyanreddy <reddyx.gundarapu@intel.com> | 2017-01-05 12:08:27 +0530 |
---|---|---|
committer | Kalyan reddy Gundarapu <reddyx.gundarapu@intel.com> | 2017-02-08 14:35:31 +0000 |
commit | be208cb48be4f4db438ce27be15e1f6166c26910 (patch) | |
tree | 9e0927d58be2bc3482f2cc4ccfe5f2dc337b27d2 /ci/envs | |
parent | 2046178d894438b492d93f30941076ee7964f6ab (diff) |
Enabling ftrace for kernel debugging.
This patch contains updated scripts to enable ftrace for kernel
debugging and storing the log files to artifact repository.
Change-Id: I81b8f987c2c214ca53a6e4502ad953a9adbc6be9
Signed-off-by: Gundarapu Kalyan Reddy <reddyx.gundarapu@intel.com>
Diffstat (limited to 'ci/envs')
-rwxr-xr-x | ci/envs/disable_trace.sh | 17 | ||||
-rwxr-xr-x | ci/envs/enable-trace.sh | 63 | ||||
-rwxr-xr-x | ci/envs/host-config | 11 |
3 files changed, 91 insertions, 0 deletions
diff --git a/ci/envs/disable_trace.sh b/ci/envs/disable_trace.sh new file mode 100755 index 000000000..1b04e62bb --- /dev/null +++ b/ci/envs/disable_trace.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -o xtrace +curpwd=`pwd` +TRACE_FILE=$1 +TRACEDIR=/sys/kernel/debug/tracing/ + +sudo bash -c "echo 0 >$TRACEDIR/tracing_on" +sleep 1 +sudo bash -c "cat $TRACEDIR/trace > $TRACE_FILE" +sudo bash -c "echo > $TRACEDIR/set_event" +sudo bash -c "echo > $TRACEDIR/trace" +sudo sysctl kernel.ftrace_enabled=0 +sudo bash -c "echo nop > $TRACEDIR/current_tracer" + +set +o xtrace +cd $curpwd diff --git a/ci/envs/enable-trace.sh b/ci/envs/enable-trace.sh new file mode 100755 index 000000000..857f53e0d --- /dev/null +++ b/ci/envs/enable-trace.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +set -o xtrace +EVENT=$1 +curpwd=`pwd` +TRACEDIR=/sys/kernel/debug/tracing/ +mv /tmp/123.txt /tmp/123.back + +function getcpumask { + masks=`lscpu | grep "NUMA node1 CPU(s)"| awk -F ':' '{print \$2}' | sed 's/[[:space:]]//g'` + first=$(echo ${masks} | cut -f1 -d-) + last=$(echo ${masks} | cut -f2 -d-) + cpumask=0 + while [ ${first} -lt ${last} ]; do + cputmp=`echo "ibase=10; obase=16; 2^(${c})" | bc` + cpumask=`echo "ibase=16; obase=10; ${cputmp}+${cpumask}" |bc` + first=`expr $first + 1` + done + highvalue=`echo "ibase=16;obase=10;$cpumask/(2^20)" |bc ` + lowvalue=`echo "ibase=16;obase=10;$cpumask%(2^20)" |bc ` + CPUMASK=`printf '%08x,%08x' 0x$highvalue 0x$lowvalue` +} + +getcpumask +sudo bash -c "echo $CPUMASK > $TRACEDIR/tracing_cpumask" + +#sudo bash -c "echo function > $TRACEDIR/current_tracer" +#echo :* > set_event +#echo $EVENT:* > set_event + +sudo bash -c "echo 1 > $TRACEDIR/events/irq/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/irq_vectors/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/task/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/syscalls/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/kmem/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/fence/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/context_tracking/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/exceptions/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/irq_vectors/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/nmi/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/kmem/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/migrate/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/sock/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/timer/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/sched/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/rcu/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/kvm/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/workqueue/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/power/enable" +sudo bash -c "echo 1 > $TRACEDIR/events/signal/enable" + +sudo bash -c "echo 1 > events/tlb/enable" + +# Clean original log info +sudo bash -c "echo > $TRACEDIR/trace" +#sudo bash -c "echo function > $TRACEDIR/current_tracer" +sudo sysctl kernel.ftrace_enabled=1 +#echo 0 >tracing_on; sleep 1; echo 1 >tracing_on; sleep 20; echo 0 >tracing_on;sleep 1; cat trace >/tmp/123.txt +sudo bash -c "echo 1 >$TRACEDIR/tracing_on" + +cd $curpwd +#source /home/yjiang5/repo/hostbin/disable_trace.sh +set +o xtrace diff --git a/ci/envs/host-config b/ci/envs/host-config index 0f77b7ac5..4742cc422 100755 --- a/ci/envs/host-config +++ b/ci/envs/host-config @@ -33,3 +33,14 @@ done #Isolated cpus from host_isolcpus range to run Stress tool stress_isolcpus=${first}-${last} echo "Stress tool runs on $stress_isolcpus" + +#Tar the log files generated during testcase execution. +function err_exit { + exitCode=$1 + cd $WORKSPACE/build_output/ + if [ -d log ];then + tar -czvf log-$(date -u +"%Y-%m-%d_%H-%M-%S").tar.gz log + fi + exit $exitCode +} + |