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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170301210829.GM15145@kernel.org>
Date:   Wed, 1 Mar 2017 18:08:29 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Hari Bathini <hbathini@...ux.vnet.ibm.com>
Cc:     ast@...com, peterz@...radead.org,
        lkml <linux-kernel@...r.kernel.org>,
        alexander.shishkin@...ux.intel.com, mingo@...hat.com,
        daniel@...earbox.net, rostedt@...dmis.org,
        Ananth N Mavinakayanahalli <ananth@...ux.vnet.ibm.com>,
        ebiederm@...ssion.com, sargun@...gun.me,
        Aravinda Prasad <aravinda@...ux.vnet.ibm.com>,
        brendan.d.gregg@...il.com, jolsa@...hat.com
Subject: Re: [PATCH v7 6/8] perf tool: add script print support for namespace
 events

Em Tue, Feb 21, 2017 at 07:32:19PM +0530, Hari Bathini escreveu:
>> Add script print support for events of type PERF_RECORD_NAMESPACES.
 

Please combine the documentation update (next patch) with this one.

And please add an the resulting output as an example, I will then try to
reproduce your tests, as such, please add as much information about how
to reproduce your tests and results in the changeset log, this way
anyone else can see how it looks like and can try to reproduce your
steps.

- Arnaldo

> Signed-off-by: Hari Bathini <hbathini@...ux.vnet.ibm.com>
> ---
>  tools/perf/builtin-script.c |   40 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
> 
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index f1ce806..66d62c9 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -830,6 +830,7 @@ struct perf_script {
>  	bool			show_task_events;
>  	bool			show_mmap_events;
>  	bool			show_switch_events;
> +	bool			show_namespace_events;
>  	bool			allocated;
>  	struct cpu_map		*cpus;
>  	struct thread_map	*threads;
> @@ -1118,6 +1119,41 @@ static int process_comm_event(struct perf_tool *tool,
>  	return ret;
>  }
>  
> +static int process_namespaces_event(struct perf_tool *tool,
> +				    union perf_event *event,
> +				    struct perf_sample *sample,
> +				    struct machine *machine)
> +{
> +	struct thread *thread;
> +	struct perf_script *script = container_of(tool, struct perf_script, tool);
> +	struct perf_session *session = script->session;
> +	struct perf_evsel *evsel = perf_evlist__id2evsel(session->evlist, sample->id);
> +	int ret = -1;
> +
> +	thread = machine__findnew_thread(machine, event->namespaces.pid,
> +					 event->namespaces.tid);
> +	if (thread == NULL) {
> +		pr_debug("problem processing NAMESPACES event, skipping it.\n");
> +		return -1;
> +	}
> +
> +	if (perf_event__process_namespaces(tool, event, sample, machine) < 0)
> +		goto out;
> +
> +	if (!evsel->attr.sample_id_all) {
> +		sample->cpu = 0;
> +		sample->time = 0;
> +		sample->tid = event->namespaces.tid;
> +		sample->pid = event->namespaces.pid;
> +	}
> +	print_sample_start(sample, thread, evsel);
> +	perf_event__fprintf(event, stdout);
> +	ret = 0;
> +out:
> +	thread__put(thread);
> +	return ret;
> +}
> +
>  static int process_fork_event(struct perf_tool *tool,
>  			      union perf_event *event,
>  			      struct perf_sample *sample,
> @@ -1293,6 +1329,8 @@ static int __cmd_script(struct perf_script *script)
>  	}
>  	if (script->show_switch_events)
>  		script->tool.context_switch = process_switch_event;
> +	if (script->show_namespace_events)
> +		script->tool.namespaces = process_namespaces_event;
>  
>  	ret = perf_session__process_events(script->session);
>  
> @@ -2181,6 +2219,8 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
>  		    "Show the mmap events"),
>  	OPT_BOOLEAN('\0', "show-switch-events", &script.show_switch_events,
>  		    "Show context switch events (if recorded)"),
> +	OPT_BOOLEAN('\0', "show-namespace-events", &script.show_namespace_events,
> +		    "Show namespace events (if recorded)"),
>  	OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"),
>  	OPT_BOOLEAN(0, "ns", &nanosecs,
>  		    "Use 9 decimal places when displaying time"),

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ