From cf5023fb9a29cd11a4e7bee82055530c11486424 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Tue, 23 Jun 2009 15:51:48 -0400 Subject: Add the bkl.stp and bkl_stats.stp examples. --- testsuite/systemtap.examples/locks/bkl.stp | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 testsuite/systemtap.examples/locks/bkl.stp (limited to 'testsuite/systemtap.examples/locks/bkl.stp') diff --git a/testsuite/systemtap.examples/locks/bkl.stp b/testsuite/systemtap.examples/locks/bkl.stp new file mode 100644 index 00000000..5dd26e18 --- /dev/null +++ b/testsuite/systemtap.examples/locks/bkl.stp @@ -0,0 +1,54 @@ +#! /usr/bin/env stap + +/* + * Copyright (C) 2009 Red Hat Inc. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU General Public License v.2. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * + * Description: displays which task is holding big kernel lock (BKL) when the + * number of waiting processes reaches a certain number. + * + * Run: stap bkl.stp + * + * Author: Flavio Leitner + */ + +# how many tasks waiting on big lock +global waiting = 0 +# who is holding big lock +global holder = 0 +global holder_time + +probe begin { printf("stap ready\n"); } + +probe end { printf("stap exiting\n"); } + +probe kernel.function("lock_kernel") { + ++waiting; +} + +probe kernel.function("lock_kernel").return { + # under biglock + holder_time = gettimeofday_us(); + holder = task_current(); + --waiting; +} + +probe kernel.function("unlock_kernel") { + # under biglock + if (waiting >= $1) { + printf("%-25s: waiting(%d), holder: %s(%d) %dus\n", + ctime(gettimeofday_s()), + waiting, + task_execname(holder), + task_pid(holder), + gettimeofday_us() - holder_time); + } +} -- cgit From 04106d61105dc517e71cad10652cd46ce604f16c Mon Sep 17 00:00:00 2001 From: William Cohen Date: Tue, 23 Jun 2009 15:52:51 -0400 Subject: Make blk.stp and blk_stats.stp executable. --- testsuite/systemtap.examples/locks/bkl.stp | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 testsuite/systemtap.examples/locks/bkl.stp (limited to 'testsuite/systemtap.examples/locks/bkl.stp') diff --git a/testsuite/systemtap.examples/locks/bkl.stp b/testsuite/systemtap.examples/locks/bkl.stp old mode 100644 new mode 100755 -- cgit