/************************************************************************** * * * Copyright (c) International Business Machines Corp., 2005 * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * 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 * * * * Author: Guanglei Li (guanglei@cn.ibm.com) * **************************************************************************/ /****************************************************** * Print the backtrace when: * * 1. cpu is idle * * 2. when an io request is dispatched to scsi layer * * ... * * * * To reduce overhead of symbol lookup,We only print * * the address sequence of backtrace, for example: * * c016844f c030fe6b * * * * Some post-processing is needed to get the symbol * * info associated with these addresses. * * * * We could use _stp_symbol_print to get such infor. * * For example: * * _stp_symbol_print(0xc016844f); * * * * The output should look like: * * 0xc016844f : sys_read+0x2/0x62 [] * ******************************************************/ probe addevent.backtrace = addevent.backtrace.cpuidle, addevent.backtrace.scsiioentry { } /* Only applicable to SMP systems Refer to addevent.tskdispatch.cpuidle in tskdispatch.stp */ probe addevent.backtrace.cpuidle = kernel.inline("idle_balance") { if(filter_by_pid() == 1 ) { log_tracedata_common(HOOKID_BT_CPUIDLE) log_backtrace_cpuidle() } } /* This failed to work on PPC64, refer to the comments in scsi.stp */ probe addevent.backtrace.scsiioentry = module("scsi_mod").function("scsi_prep_fn") { if(filter_by_pid() == 1 ) { log_tracedata_common(HOOKID_BT_IOREQ_TO_SCSI) log_backtrace_scsiioentry() } } function log_backtrace_cpuidle() %{ /* print the backtrace without symbols information */ _stp_stack_sprint(_stp_stdout,CONTEXT->regs,0); _stp_printf("|"); %} function log_backtrace_scsiioentry() %{ /* print the backtrace without symbols information */ _stp_stack_sprint(_stp_stdout,CONTEXT->regs,0); _stp_printf("|"); %}