Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751928AbdGAOrH (ORCPT ); Sat, 1 Jul 2017 10:47:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42312 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751805AbdGAOrG (ORCPT ); Sat, 1 Jul 2017 10:47:06 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 46E795D687 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=acme@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 46E795D687 Date: Sat, 1 Jul 2017 11:47:03 -0300 From: Arnaldo Carvalho de Melo To: Arun Kalyanasundaram Cc: tzanussi@gmail.com, linux-kernel@vger.kernel.org, David Carrillo-Cisneros , acme@kernel.org Subject: Re: perf script: Question: Python trace processing script contains the tid of the process in the common_pid attribute Message-ID: <20170701144703.GA5504@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.20 (2009-12-10) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sat, 01 Jul 2017 14:47:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1137 Lines: 28 Em Fri, Jun 30, 2017 at 03:40:57PM -0700, Arun Kalyanasundaram escreveu: > The handlers in the python script generated from "perf script" have an > attribute: common_pid. This attribute contains the tid of the process > instead of its pid. I would like to know if this is the expected behavior. > There are no other attributes in the Python handler that provide the pid > and knowing the process id is useful to be able to group all samples that > belong to the same process that generated different threads. Humm, you have: def process_event(param_dict): event_attr = param_dict["attr"] sample = param_dict["sample"] raw_buf = param_dict["raw_buf"] comm = param_dict["comm"] name = param_dict["ev_name"] And then, on sample you have (from a recent python script for processing Intel PT samples): def print_common_start(comm, sample, name): ts = sample["time"] cpu = sample["cpu"] pid = sample["pid"] tid = sample["tid"] print "%16s %5u/%-5u [%03u] %9u.%09u %7s:" % (comm, pid, tid, cpu, ts / 1000000000, ts %1000000000, name), - Arnaldo