summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/general/key.stp
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2008-08-07 16:47:18 -0400
committerFrank Ch. Eigler <fche@elastic.org>2008-08-07 16:47:18 -0400
commit384c5fe974abe35ab11dce4446dc5eed86585a3b (patch)
tree9bbdc8206d4a9c08866dc2251e40f4f7249696d4 /testsuite/systemtap.examples/general/key.stp
parent9b3f22a9b83c4fd5e66874d78f4d35ad742ff802 (diff)
downloadsystemtap-steved-384c5fe974abe35ab11dce4446dc5eed86585a3b.tar.gz
systemtap-steved-384c5fe974abe35ab11dce4446dc5eed86585a3b.tar.xz
systemtap-steved-384c5fe974abe35ab11dce4446dc5eed86585a3b.zip
samples: separate into subdirectories by subsystem
Diffstat (limited to 'testsuite/systemtap.examples/general/key.stp')
-rwxr-xr-xtestsuite/systemtap.examples/general/key.stp22
1 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/general/key.stp b/testsuite/systemtap.examples/general/key.stp
new file mode 100755
index 00000000..6d2d6c3f
--- /dev/null
+++ b/testsuite/systemtap.examples/general/key.stp
@@ -0,0 +1,22 @@
+#! /usr/bin/env stap
+
+# Useless, but amusing. Based on an idea I saw on a
+# dtrace site. (wav files are from emacs).
+
+// KEY_ENTER = 28
+probe kernel.function("kbd_event") {
+ if ($event_type == 1 && $value) {
+ if ($event_code == 28)
+ system("play return.wav &> /dev/null")
+ else
+ system("play click.wav &> /dev/null")
+ }
+}
+
+probe begin {
+ printf("TYPEWRITER ON\n")
+}
+
+probe end {
+ printf("DONE\n")
+}