Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /proc/thread-self/root/opt/rh/gcc-toolset-11/root/usr/share/systemtap/examples/locks/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/thread-self/root/opt/rh/gcc-toolset-11/root/usr/share/systemtap/examples/locks/bkl.stp
#!/opt/rh/gcc-toolset-11/root/usr/bin/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, see <http://www.gnu.org/licenses/>.
 *
 *
 * Description: displays which task is holding big kernel lock (BKL) when the 
 *              number of waiting processes reaches a certain number.
 *
 * Run: stap bkl.stp [-G backtrace=<usecs>] <number_of_processes_waiting>
 *
 * Author: Flavio Leitner <[email protected]>
 * Modified by Jose Castillo <[email protected]> by adding
 * print_backtrace() to get the codepath of the function
 * that holds the bkl and an optional backtrace value that
 * enables/disables print_backtrace().
 */

# how many tasks waiting on big lock
global waiting = 0

# when the current holder first obtained the lock
global holder_time

# are we printing backtraces?
global backtrace = -1

probe begin { 
  printf("stap ready\n"); 
}

probe kernel.function("_lock_kernel").call!,
      kernel.function("lock_kernel").call
{
  ++waiting;
}

probe kernel.function("_lock_kernel").return!,
      kernel.function("lock_kernel").return
{
  # under biglock
  holder_time = gettimeofday_us();
  --waiting;
}

probe kernel.function("_unlock_kernel")!,
      kernel.function("unlock_kernel")
{
  # under biglock
  backtrace_enabled = 0
  if (waiting >= $1) {
    if (holder_time != 0) {
       waiting_time = gettimeofday_us() - holder_time
       if ( backtrace != -1 && waiting_time >= backtrace ) {
                backtrace_enabled = 1
       }
    }
    else {
       waiting_time = -1;
    }

    printf("%-25s: waiting(%d), holder: %s(%d) %dus\n",
           ctime(gettimeofday_s()),
           waiting,
           execname(),
           pid(),
           (holder_time != 0) ? gettimeofday_us() - holder_time : -1);

    if (backtrace_enabled)
            print_backtrace()

  }
  holder_time = 0
}

probe end { printf("stap exiting\n"); }

Spamworldpro Mini