lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 19 Aug 2014 15:23:12 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	jolsa@...hat.com, linux-kernel@...r.kernel.org, acme@...nel.org,
	mingo@...nel.org, peterz@...radead.org,
	Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH] perf, tools: Add PERF_PID

Hi Andi,

On Wed, 13 Aug 2014 14:12:17 -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@...ux.intel.com>
>
> It's currently difficult to filter out perf itself using a filter.
> This can give cascading effects during IO tracing when the IO
> perf does itself causes more trace output.
>
> The best way to filter is to use the pid. But it's difficult to get the pid
> of perf without using hacks.
>
> Add a PERF_PID meta variable to the perf filter that contains the current pid.
>
> With this patch the following works
>
> % perf record -e syscalls:sys_enter_write -a --filter 'common_pid != PERF_PID' ...
>
> This won't work for more complex perf pipe lines with multiple processes,
> but at least solves the problem nicely for a single perf.
>
> Signed-off-by: Andi Kleen <ak@...ux.intel.com>

I like the idea, so with comments below fixed:

Acked-by: Namhyung Kim <namhyung@...nel.org>

Thanks,
Namhyung


[SNIP]
> +	/* Assume a pid has not more than 8 characters */
> +	pid = strstr(last->filter, "PERF_PID");
> +	if (pid) {
> +		char buf[9];
> +		snprintf(buf, 9, "%08d", getpid());

Why do you add zero-paddings?  I guess it'd confuse the parser as if
it's an octal digits.  What about just using "%8d"?  It seems the parser
ignores whitespaces between tokens..


> +		memcpy(pid, buf, 8);
> +	}
> +	fprintf(stderr, "filter |%s|\n", last->filter);

Isn't it a debug message?

Thanks,
Namhyung


>  	return 0;
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ