/************************************************************************** * * * 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) * **************************************************************************/ /* return the current name of probe point */ function probename:string () %{ char *ptr, *tok; char buffer[MAXSTRINGLEN]; strlcpy(buffer, CONTEXT->probe_point, MAXSTRINGLEN); ptr = buffer; tok = strsep(&ptr, "\""); tok = strsep(&ptr, "@"); strlcpy (THIS->__retvalue, tok, MAXSTRINGLEN); %} /* data tracing filter by pid return: 1 - if continue to log the raw data 0 - return without logging the raw data */ function filter_by_pid:long() %{ struct task_struct *cur = current; if(cur->tgid != _stp_pid) { /* to trace a specific process if we explicitly specify which process we want to trace by: 1. stap -c "process_to_trace" ... 2. stap -x pid_to_trace ... else we will trace all the processes */ if( _stp_target != 0 && cur->tgid != _stp_target) { THIS->__retvalue = 0; return; } THIS->__retvalue = 1; } else /*skip the events generated by stap itself*/ THIS->__retvalue = 0; return; %}