From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhXSr-0002pC-LM for qemu-devel@nongnu.org; Tue, 15 Aug 2017 04:44:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhXSq-0005xe-OZ for qemu-devel@nongnu.org; Tue, 15 Aug 2017 04:44:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50122) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dhXSq-0005xN-F4 for qemu-devel@nongnu.org; Tue, 15 Aug 2017 04:44:40 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B1D7AC2DA for ; Tue, 15 Aug 2017 08:44:39 +0000 (UTC) From: Stefan Hajnoczi Date: Tue, 15 Aug 2017 09:44:29 +0100 Message-Id: <20170815084430.7128-2-stefanha@redhat.com> In-Reply-To: <20170815084430.7128-1-stefanha@redhat.com> References: <20170815084430.7128-1-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH for-2.10 v2 1/2] trace: use static event ID mapping in simpletrace.stp List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Daniel Berrange , Stefan Hajnoczi This is a partial revert of commit 7f1b588f20d027730676e627713ae3bbf6baab04 ("trace: emit name <-> ID mapping in simpletrace header"), which broke the SystemTap flight recorder because event mapping records may not be present in the ring buffer when the trace is analyzed. This means simpletrace.py --no-header does not know the event ID mapping needed to pretty-print the trace. Instead of numbering events dynamically, use a static event ID mapping as dictated by the event order in the trace-events-all file. The simpletrace.py script also uses trace-events-all so the next patch will fix the simpletrace.py --no-header option to take advantage of this knowledge. Cc: Daniel P. Berrange Signed-off-by: Stefan Hajnoczi --- scripts/tracetool/format/simpletrace_stap.py | 31 ++-------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/scripts/tracetool/format/simpletrace_stap.py b/scripts/tracetool/format/simpletrace_stap.py index 144b704bcd..e7e44842ca 100644 --- a/scripts/tracetool/format/simpletrace_stap.py +++ b/scripts/tracetool/format/simpletrace_stap.py @@ -22,33 +22,8 @@ def global_var_name(name): return probeprefix().replace(".", "_") + "_" + name def generate(events, backend, group): - id_map = global_var_name("event_name_to_id_map") - next_id = global_var_name("event_next_id") - map_func = global_var_name("simple_trace_map_event") out('/* This file is autogenerated by tracetool, do not edit. */', - '', - 'global %(id_map)s', - 'global %(next_id)s', - 'function %(map_func)s(name)', - '', - '{', - ' if (!([name] in %(id_map)s)) {', - ' %(id_map)s[name] = %(next_id)s', - ' name_len = strlen(name)', - ' printf("%%8b%%8b%%4b%%.*s", 0, ', - ' %(next_id)s, name_len, name_len, name)', - ' %(next_id)s = %(next_id)s + 1', - ' }', - ' return %(id_map)s[name]', - '}', - 'probe begin', - '{', - ' printf("%%8b%%8b%%8b", 0xffffffffffffffff, 0xf2b177cb0aa429b4, 4)', - '}', - '', - id_map=id_map, - next_id=next_id, - map_func=map_func) + '') for event_id, e in enumerate(events): if 'disable' in e.properties: @@ -56,9 +31,7 @@ def generate(events, backend, group): out('probe %(probeprefix)s.simpletrace.%(name)s = %(probeprefix)s.%(name)s ?', '{', - ' id = %(map_func)s("%(name)s")', probeprefix=probeprefix(), - map_func=map_func, name=e.name) # Calculate record size @@ -77,7 +50,7 @@ def generate(events, backend, group): sizestr = ' + '.join(sizes) # Generate format string and value pairs for record header and arguments - fields = [('8b', 'id'), + fields = [('8b', str(event_id)), ('8b', 'gettimeofday_ns()'), ('4b', sizestr), ('4b', 'pid()')] -- 2.13.4