From: zhaolei@cn.fujitsu.com (Zhaolei)
Subject: [ltt-dev] [PATCH v2] Remove ltt-armall/disarmall's unwanted error messages
Date: Fri, 17 Oct 2008 11:28:30 +0800 [thread overview]
Message-ID: <48F8065E.8080503@cn.fujitsu.com> (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
next reply other threads:[~2008-10-17 3:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-17 3:28 Zhaolei [this message]
[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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48F8065E.8080503@cn.fujitsu.com \
--to=zhaolei@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox