summaryrefslogtreecommitdiffstats
path: root/tapset/LKET/utils.stp
blob: 5bff6a9f70b849beb18b6cc4e7019e97d7bd5f19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (C) 2005, 2006 IBM Corp.
//
// This file is part of systemtap, and is free software.  You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.

/* 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;
%}

function reset_maxaction()
%{
	struct context* c;
	int cpu;
	for_each_online_cpu(cpu) {
		c = per_cpu_ptr (contexts, cpu);
		c->actioncount = 0;
	}
%}