80dd5c49 | 04-Oct-2016 |
Daniel P. Berrange <berrange@redhat.com> |
trace: introduce a formal group name for trace events
The declarations in the generated-tracers.h file are assuming there's only ever going to be one instance of this header, as they are not namespa
trace: introduce a formal group name for trace events
The declarations in the generated-tracers.h file are assuming there's only ever going to be one instance of this header, as they are not namespaced. When we have one header per event group, if a single source file needs to include multiple sets of trace events, the symbols will all clash.
This change thus introduces a '--group NAME' arg to the 'tracetool' program. This will cause all the symbols in the generated header files to be given a unique namespace.
If no group is given, the group name 'common' is used, which is suitable for the current usage where there is only one global trace-events file used for code generation.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Message-id: 1475588159-30598-21-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
34770187 | 04-Oct-2016 |
Daniel P. Berrange <berrange@redhat.com> |
trace: get rid of generated-events.h/generated-events.c
Currently the generated-events.[ch] files contain the event dstates, constants and TraceEvent structs, while the generated-tracers.[ch] files
trace: get rid of generated-events.h/generated-events.c
Currently the generated-events.[ch] files contain the event dstates, constants and TraceEvent structs, while the generated-tracers.[ch] files contain the actual trace probe logic. With the removal of usage of the event enums from the API there is no longer any compelling reason for the separation between these files. The generated-events.h content is only ever needed from the generated-tracers.[ch] files.
The enums/constants/structs from generated-events.[ch] are thus moved into the generated-tracers.[ch], so that there is one less file to be generated.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-17-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
ca3fa0e8 | 04-Oct-2016 |
Daniel P. Berrange <berrange@redhat.com> |
trace: dynamically allocate event IDs at runtime
Instead of having the code generator assign event IDs and event VCPU IDs, assign them when the events are registered at runtime. This will allow code
trace: dynamically allocate event IDs at runtime
Instead of having the code generator assign event IDs and event VCPU IDs, assign them when the events are registered at runtime. This will allow code to be generated from individual trace-events without having to figure out globally unique numbering at build time.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-16-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
fe4db84d | 04-Oct-2016 |
Daniel P. Berrange <berrange@redhat.com> |
trace: provide mechanism for registering trace events
Remove the notion of there being a single global array of trace events, by introducing a method for registering groups of events.
The module_ca
trace: provide mechanism for registering trace events
Remove the notion of there being a single global array of trace events, by introducing a method for registering groups of events.
The module_call_init() needs to be invoked at the start of any program that wants to make use of the trace support. Currently this covers system emulators qemu-nbd, qemu-img and qemu-io.
[Squashed the following fix from Daniel P. Berrange <berrange@redhat.com>:
linux-user/bsd-user: initialize trace events subsystem
The bsd-user/linux-user programs make use of the CPU emulation code and this now requires that the trace events subsystem is enabled, otherwise it'll crash trying to allocate an empty trace events bitmap for the CPU object.
--Stefan]
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-14-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
7f1b588f | 04-Oct-2016 |
Daniel P. Berrange <berrange@redhat.com> |
trace: emit name <-> ID mapping in simpletrace header
Currently simpletrace assumes that events are given IDs starting from 0, based on the order in which they appear in the trace-events file, with
trace: emit name <-> ID mapping in simpletrace header
Currently simpletrace assumes that events are given IDs starting from 0, based on the order in which they appear in the trace-events file, with no gaps. When the trace-events file is split up, this assumption becomes problematic.
To deal with this, extend the simpletrace format so that it outputs a table of event name <-> ID mappings. That will allow QEMU to assign arbitrary IDs to events without breaking simpletrace parsing.
The v3 simple trace format was
FILE HEADER EVENT TRACE RECORD 0 EVENT TRACE RECORD 1 ... EVENT TRACE RECORD N
The v4 simple trace format is now
FILE HEADER EVENT MAPPING RECORD 0 EVENT MAPPING RECORD 1 ... EVENT MAPPING RECORD M EVENT TRACE RECORD RECORD 0 EVENT TRACE RECORD RECORD 1 ... EVENT TRACE RECORD N
Although this shows all the mapping records being emitted upfront, this is not required by the format. While the main simpletrace backend will emit all mappings at startup, the systemtap simpletrace.stp script will emit the mappings at first use. eg
FILE HEADER ... EVENT MAPPING RECORD 0 EVENT TRACE RECORD RECORD 0 EVENT TRACE RECORD RECORD 1 EVENT MAPPING RECORD 1 EVENT TRACE RECORD RECORD 2 ... EVENT TRACE RECORD N
This is more space efficient given that most trace records only include a subset of events.
In modifying the systemtap simpletrace code, a 'begin' probe was added to emit the trace event header, so you no longer need to add '--no-header' when running simpletrace.py for systemtap generated trace files.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-12-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
ef4c9fc8 | 04-Oct-2016 |
Daniel P. Berrange <berrange@redhat.com> |
trace: remove the TraceEventID and TraceEventVCPUID enums
The TraceEventID and TraceEventVCPUID enums constants are no longer actually used for anything critical.
The TRACE_EVENT_COUNT limit is use
trace: remove the TraceEventID and TraceEventVCPUID enums
The TraceEventID and TraceEventVCPUID enums constants are no longer actually used for anything critical.
The TRACE_EVENT_COUNT limit is used to determine the size of the TraceEvents array, and can be removed if we just NULL terminate the array instead.
The TRACE_VCPU_EVENT_COUNT limit is used as a magic value for marking non-vCPU events, and also for declaring the size of the trace dstate mask in the CPUState struct. The former usage can be replaced by a dedicated constant TRACE_EVENT_VCPU_NONE, defined as (uint32_t)-1. For the latter usage, we can simply define a constant for the number of VCPUs, avoiding the need for the full enum.
The only other usages of the enum values can be replaced by accesing the id/vcpu_id fields via the named TraceEvent structs.
Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-11-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
79218be4 | 04-Oct-2016 |
Daniel P. Berrange <berrange@redhat.com> |
trace: give each trace event a named TraceEvent struct
Currently we only expose a TraceEvent array, which must be indexed via the TraceEventID enum constants. This changes the generator to expose a
trace: give each trace event a named TraceEvent struct
Currently we only expose a TraceEvent array, which must be indexed via the TraceEventID enum constants. This changes the generator to expose a named TraceEvent instance for each event, with an _EVENT suffix.
Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1475588159-30598-10-git-send-email-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
f4654226 | 30-May-2014 |
Lluís Vilanova <vilanova@ac.upc.edu> |
trace: [tcg] Define TCG tracing helper routine wrappers
Generates header "trace/generated-helpers-wrappers.h" with definitions for TCG helper wrappers.
These wrappers ('gen_helper_trace_${event}_ex
trace: [tcg] Define TCG tracing helper routine wrappers
Generates header "trace/generated-helpers-wrappers.h" with definitions for TCG helper wrappers.
These wrappers ('gen_helper_trace_${event}_exec_wrapper') transform mixed native and TCG argument types to TCG types and call the actual TCG helpers ('gen_helper_trace_${event}_exec_proxy').
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|