From b473bbbbddd782edbe212b16fb839ec4a2e03bbd Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Wed, 16 Aug 2017 11:47:58 +0200 Subject: [PATCH 1/4] trace: use static event ID mapping in simpletrace.stp RH-Author: Stefan Hajnoczi Message-id: <20170816114759.8421-2-stefanha@redhat.com> Patchwork-id: 75954 O-Subject: [RHV-7.4.z qemu-kvm-rhev PATCH 1/2] trace: use static event ID mapping in simpletrace.stp Bugzilla: 1482515 RH-Acked-by: Dr. David Alan Gilbert RH-Acked-by: Markus Armbruster RH-Acked-by: John Snow 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 Reviewed-by: Daniel P. Berrange Message-id: 20170815084430.7128-2-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi (cherry picked from commit d6b76d68054b81943648ab0af2f9634ae946854b) Signed-off-by: Miroslav Rezanina Conflicts: scripts/tracetool/format/simpletrace_stap.py Context conflicts because downstream lacks commit ea1ff54f7d ("trace: ensure unique function / variable names per .stp file"). Do not backport that commit because it is obsoleted by this patch. Signed-off-by: Stefan Hajnoczi --- scripts/tracetool/format/simpletrace_stap.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/scripts/tracetool/format/simpletrace_stap.py b/scripts/tracetool/format/simpletrace_stap.py index c35e662..6172ad0 100644 --- a/scripts/tracetool/format/simpletrace_stap.py +++ b/scripts/tracetool/format/simpletrace_stap.py @@ -21,25 +21,6 @@ from tracetool.format.stap import stap_escape def generate(events, backend, group): out('/* This file is autogenerated by tracetool, do not edit. */', - '', - 'global event_name_to_id_map', - 'global event_next_id', - 'function simple_trace_map_event(name)', - '', - '{', - ' if (!([name] in event_name_to_id_map)) {', - ' event_name_to_id_map[name] = event_next_id', - ' name_len = strlen(name)', - ' printf("%%8b%%8b%%4b%%.*s", 0, ', - ' event_next_id, name_len, name_len, name)', - ' event_next_id = event_next_id + 1', - ' }', - ' return event_name_to_id_map[name]', - '}', - 'probe begin', - '{', - ' printf("%%8b%%8b%%8b", 0xffffffffffffffff, 0xf2b177cb0aa429b4, 4)', - '}', '') for event_id, e in enumerate(events): @@ -48,7 +29,6 @@ def generate(events, backend, group): out('probe %(probeprefix)s.simpletrace.%(name)s = %(probeprefix)s.%(name)s ?', '{', - ' id = simple_trace_map_event("%(name)s")', probeprefix=probeprefix(), name=e.name) @@ -68,7 +48,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()')] -- 1.8.3.1