Re: [PATCH v4 2/3] perf tool: add PERF_RECORD_NAMESPACES to include namespaces related info

From: Jiri Olsa
Date: Sat Dec 17 2016 - 12:40:26 EST


On Fri, Dec 16, 2016 at 12:07:20AM +0530, Hari Bathini wrote:

SNIP

> +
> +int thread__set_namespaces(struct thread *thread, u64 timestamp,
> + struct namespaces_event *event)
> +{
> + struct namespaces *new, *curr = thread__namespaces(thread);
> +
> + new = namespaces__new(event);
> + if (!new)
> + return -ENOMEM;
> +
> + list_add(&new->list, &thread->namespaces_list);
> +
> + if (timestamp && curr) {
> + /*
> + * setns syscall must have changed few or all the namespaces
> + * of this thread. Update end time for the namespaces
> + * previously used.
> + */
> + curr = list_next_entry(new, list);
> + curr->end_time = timestamp;

hi,
couldn't you use just the curr you got from thread__namespaces?
why to retrieve it again via 'new' pointer?

thanks,
jirka