* [ltt-dev] [PATCH v2] Remove ltt-armall/disarmall's unwanted error messages
@ 2008-10-17 3:28 Zhaolei
[not found] ` <20081017040033.GA5067@Krystal>
0 siblings, 1 reply; 3+ messages in thread
From: Zhaolei @ 2008-10-17 3:28 UTC (permalink / raw)
Hi Mathieu,
> Hrm, is it possible to make the write to /proc/ltt return something else
> that would indicate that the marker is already connected and use that
> instead ? Otherwise, this can be problematic if two instances of
> ltt-armall are executed in parallel.
>
Thanks for your reply, I rewrote the following patch based on your advice.
Signed-off-by: Zhaolei <zhaolei at cn.fujitsu.com>
---
diff -Nur ltt-control-0.54-10102008.org/lttctl/ltt-armall.sh ltt-control-0.54-10102008/lttctl/ltt-armall.sh
--- ltt-control-0.54-10102008.org/lttctl/ltt-armall.sh 2008-10-15 15:29:54.000000000 +0800
+++ ltt-control-0.54-10102008/lttctl/ltt-armall.sh 2008-10-17 11:14:20.000000000 +0800
@@ -5,7 +5,7 @@
MARKERS=`cat /proc/ltt|grep -v %k|awk '{print $2}'|sort -u|grep -v ^core_|grep -v ^locking_|grep -v ^lockdep_`
for a in $MARKERS; do
- echo Connecting $a
+ echo -n " Connecting $a: "
#redirect markers carrying state information to dedicated channels
case $a in
@@ -26,7 +26,20 @@
;;
esac
- echo "connect $a default dynamic $CHANNEL" > /proc/ltt
+ err=`LANG=C;echo "connect $a default dynamic $CHANNEL" 2>&1 >/proc/ltt`
+ if [ -z "$err" ]
+ then
+ echo "OK"
+ continue
+ fi
+
+ if echo "$err" | grep -q "write error: File exists$"
+ then
+ echo "Already connected"
+ continue
+ fi
+
+ echo "$err"
done
@@ -39,7 +52,7 @@
#MARKERS=`cat /proc/ltt|grep -v %k|awk '{print $2}'|sort -u|grep -e ^tap_ -e ^lockdep`
for a in $MARKERS; do
- echo Connecting $a
+ echo -n " Connecting $a: "
#redirect markers carrying state information to dedicated channels
case $a in
@@ -48,5 +61,18 @@
;;
esac
- echo "connect $a ltt_tap_marker dynamic $CHANNEL" > /proc/ltt
+ err=`LANG=C;echo "connect $a ltt_tap_marker dynamic $CHANNEL" 2>&1 >/proc/ltt`
+ if [ -z "$err" ]
+ then
+ echo "OK"
+ continue
+ fi
+
+ if echo "$err" | grep -q "write error: File exists$"
+ then
+ echo "Already connected"
+ continue
+ fi
+
+ echo "$err"
done
diff -Nur ltt-control-0.54-10102008.org/lttctl/ltt-disarmall.sh ltt-control-0.54-10102008/lttctl/ltt-disarmall.sh
--- ltt-control-0.54-10102008.org/lttctl/ltt-disarmall.sh 2008-10-15 15:29:54.000000000 +0800
+++ ltt-control-0.54-10102008/lttctl/ltt-disarmall.sh 2008-10-17 11:14:43.000000000 +0800
@@ -2,7 +2,26 @@
#excluding core markers, not connected to default.
echo Disconnecting all markers
MARKERS=`cat /proc/ltt|grep -v %k|awk '{print $2}'|sort -u|grep -v ^core_|grep -v ^locking_|grep -v ^lockdep_|grep -v ^lockdep|grep -v ^tap_`
-for a in $MARKERS; do echo Disconnecting $a; echo "disconnect $a" > /proc/ltt; done
+for a in $MARKERS
+do
+ echo -n " Disconnecting $a: "
+
+ err=`LANG=C;echo "disconnect $a" 2>&1 >/proc/ltt`
+
+ if [ -z "$err" ]
+ then
+ echo "OK"
+ continue
+ fi
+
+ if echo "$err" | grep -q "write error: No such file or directory$"
+ then
+ echo "Already disconnected"
+ continue
+ fi
+
+ echo "$err"
+done
# Markers starting with "tap_" are considered high-speed.
echo Disconnecting high-rate markers to tap
@@ -11,8 +30,23 @@
#Uncomment the following to also stop recording lockdep events.
#MARKERS=`cat /proc/ltt|grep -v %k|awk '{print $2}'|sort -u|grep -e ^tap_ -e ^lockdep`
-for a in $MARKERS; do
- echo Disconnecting $a
+for a in $MARKERS
+do
+ echo -n " Disconnecting $a: "
+
+ err=`LANG=C;echo "disconnect $a ltt_tap_marker" 2>&1 >/proc/ltt`
+
+ if [ -z "$err" ]
+ then
+ echo "OK"
+ continue
+ fi
+
+ if echo "$err" | grep -q "write error: No such file or directory$"
+ then
+ echo "Already disconnected"
+ continue
+ fi
- echo "disconnect $a ltt_tap_marker" > /proc/ltt
+ echo "$err"
done
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-10-21 1:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-17 3:28 [ltt-dev] [PATCH v2] Remove ltt-armall/disarmall's unwanted error messages Zhaolei
[not found] ` <20081017040033.GA5067@Krystal>
2008-10-17 4:14 ` [ltt-dev] [PATCH v2] Remove ltt-armall/disarmall's unwanted errormessages Zhaolei
[not found] ` <20081020155223.GC28562@Krystal>
2008-10-21 1:52 ` Zhaolei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox