Patchwork trace: added ability to comment out events in the list

login
register
mail settings
Submitter Alexey Kardashevskiy
Date June 14, 2012, 4:41 a.m.
Message ID <4FD96B84.6080907@ozlabs.ru>
Download mbox | patch
Permalink /patch/164808/
State New
Headers show

Comments

Alexey Kardashevskiy - June 14, 2012, 4:41 a.m.
It is convenient for debug to be able to switch on/off some events easily.
The only possibility now is to remove event name from the file completely
and type it again when we want it back.

The patch adds '#' symbol handling as a comment specifier.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 trace/control.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Stefan Hajnoczi - June 14, 2012, 1:18 p.m.
On Thu, Jun 14, 2012 at 02:41:40PM +1000, Alexey Kardashevskiy wrote:
> It is convenient for debug to be able to switch on/off some events easily.
> The only possibility now is to remove event name from the file completely
> and type it again when we want it back.
> 
> The patch adds '#' symbol handling as a comment specifier.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>  trace/control.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)

Thanks, applied to the tracing patches tree:
https://github.com/stefanha/qemu/commits/tracing

Stefan
Alexey Kardashevskiy - June 15, 2012, 4:36 a.m.
On 14/06/12 23:18, Stefan Hajnoczi wrote:
> On Thu, Jun 14, 2012 at 02:41:40PM +1000, Alexey Kardashevskiy wrote:
>> It is convenient for debug to be able to switch on/off some events easily.
>> The only possibility now is to remove event name from the file completely
>> and type it again when we want it back.
>>
>> The patch adds '#' symbol handling as a comment specifier.
>>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> ---
>>  trace/control.c |    3 +++
>>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> Thanks, applied to the tracing patches tree:
> https://github.com/stefanha/qemu/commits/tracing

Cannot find it there though :)
Stefan Hajnoczi - June 15, 2012, 8:35 a.m.
On Fri, Jun 15, 2012 at 5:36 AM, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> On 14/06/12 23:18, Stefan Hajnoczi wrote:
>> On Thu, Jun 14, 2012 at 02:41:40PM +1000, Alexey Kardashevskiy wrote:
>>> It is convenient for debug to be able to switch on/off some events easily.
>>> The only possibility now is to remove event name from the file completely
>>> and type it again when we want it back.
>>>
>>> The patch adds '#' symbol handling as a comment specifier.
>>>
>>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>> ---
>>>  trace/control.c |    3 +++
>>>  1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> Thanks, applied to the tracing patches tree:
>> https://github.com/stefanha/qemu/commits/tracing
>
> Cannot find it there though :)

I just pushed the 'tracing' branch, sorry for the delay!

Stefan

Patch

diff --git a/trace/control.c b/trace/control.c
index 4c5527d..22d5863 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -27,6 +27,9 @@  void trace_backend_init_events(const char *fname)
         size_t len = strlen(line_buf);
         if (len > 1) {              /* skip empty lines */
             line_buf[len - 1] = '\0';
+            if ('#' == line_buf[0]) { /* skip commented lines */
+                continue;
+            }
             if (!trace_event_set_state(line_buf, true)) {
                 fprintf(stderr,
                         "error: trace event '%s' does not exist\n", line_buf);