From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756429AbbLWQEP (ORCPT ); Wed, 23 Dec 2015 11:04:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48263 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753398AbbLWQEO (ORCPT ); Wed, 23 Dec 2015 11:04:14 -0500 Date: Wed, 23 Dec 2015 17:04:11 +0100 From: Jiri Olsa To: Namhyung Kim Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , David Ahern , Ingo Molnar , Peter Zijlstra , "Liang, Kan" Subject: Re: [PATCH 7/8] perf script: Add python support for stat events Message-ID: <20151223160411.GB14636@krava.brq.redhat.com> References: <1450799014-31469-1-git-send-email-jolsa@kernel.org> <1450799014-31469-8-git-send-email-jolsa@kernel.org> <20151223134247.GC23199@danjae.kornet> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151223134247.GC23199@danjae.kornet> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 23, 2015 at 10:42:47PM +0900, Namhyung Kim wrote: SNIP > > +static void > > +process_stat(struct perf_evsel *counter, int cpu, int thread, u64 time, > > + struct perf_counts_values *count) > > +{ > > + PyObject *handler, *t; > > + static char handler_name[256]; > > + int n = 0; > > + > > + t = PyTuple_New(MAX_FIELDS); > > + if (!t) > > + Py_FatalError("couldn't create Python tuple"); > > + > > + get_handler_name(handler_name, sizeof(handler_name), > > + counter); > > + > > + handler = get_handler(handler_name); > > + if (!handler) { > > + pr_debug("can't find python handler %s\n", handler_name); > > + return; > > + } > > + > > + PyTuple_SetItem(t, n++, PyInt_FromLong(cpu)); > > + PyTuple_SetItem(t, n++, PyInt_FromLong(thread)); > > + PyTuple_SetItem(t, n++, PyLong_FromLong(time)); > > + PyTuple_SetItem(t, n++, PyLong_FromLong(count->val)); > > + PyTuple_SetItem(t, n++, PyLong_FromLong(count->ena)); > > + PyTuple_SetItem(t, n++, PyLong_FromLong(count->run)); > > What about 32-bit systems? It seems the PyLong_FromLong() takes long > but the counts are u64. hum, if it does I think we'll have problems in other parts of python code.. I'll check, thanks jirka