diff mbox series

[RFC,06/21] trace: show trace point counts in the monitor

Message ID 20181005154910.3099-7-alex.bennee@linaro.org
State New
Headers show
Series Trace updates and plugin RFC | expand

Commit Message

Alex Bennée Oct. 5, 2018, 3:48 p.m. UTC
Now we have counts for each trace point we can expose them in the
monitor when the user queries what trace points are available.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 monitor.c       | 5 +++--
 qapi/trace.json | 3 ++-
 trace/qmp.c     | 1 +
 3 files changed, 6 insertions(+), 3 deletions(-)

-- 
2.17.1

Comments

Richard Henderson Oct. 6, 2018, 6:27 p.m. UTC | #1
On 10/5/18 8:48 AM, Alex Bennée wrote:
> Now we have counts for each trace point we can expose them in the

> monitor when the user queries what trace points are available.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  monitor.c       | 5 +++--

>  qapi/trace.json | 3 ++-

>  trace/qmp.c     | 1 +

>  3 files changed, 6 insertions(+), 3 deletions(-)


I would have merged this with previous, but whatever.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>



r~
Markus Armbruster Oct. 8, 2018, 12:51 p.m. UTC | #2
Alex Bennée <alex.bennee@linaro.org> writes:

> Now we have counts for each trace point we can expose them in the

> monitor when the user queries what trace points are available.

>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  monitor.c       | 5 +++--

>  qapi/trace.json | 3 ++-

>  trace/qmp.c     | 1 +

>  3 files changed, 6 insertions(+), 3 deletions(-)

>

> diff --git a/monitor.c b/monitor.c

> index c4677b502b..d8229cd2b0 100644

> --- a/monitor.c

> +++ b/monitor.c

> @@ -1421,9 +1421,10 @@ static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)

>      }

>  

>      for (elem = events; elem != NULL; elem = elem->next) {

> -        monitor_printf(mon, "%s : state %u\n",

> +        monitor_printf(mon, "%s : state %u count %" PRIu64 "\n",

>                         elem->value->name,

> -                       elem->value->state == TRACE_EVENT_STATE_ENABLED ? 1 : 0);

> +                       elem->value->state == TRACE_EVENT_STATE_ENABLED ? 1 : 0,

> +                       elem->value->count);

>      }

>      qapi_free_TraceEventInfoList(events);

>  }

> diff --git a/qapi/trace.json b/qapi/trace.json

> index 799b254a18..b9184b0d18 100644

> --- a/qapi/trace.json

> +++ b/qapi/trace.json

> @@ -33,6 +33,7 @@

>  # @name: Event name.

>  # @state: Tracing state.

>  # @vcpu: Whether this is a per-vCPU event (since 2.7).

> +# @count: Current hits on trace-point (since 3.1).


Suggest something like "Number of hits".

>  #

>  # An event is per-vCPU if it has the "vcpu" property in the "trace-events"

>  # files.

> @@ -40,7 +41,7 @@

>  # Since: 2.2

>  ##

>  { 'struct': 'TraceEventInfo',

> -  'data': {'name': 'str', 'state': 'TraceEventState', 'vcpu': 'bool'} }

> +  'data': {'name': 'str', 'state': 'TraceEventState', 'vcpu': 'bool', 'count': 'int' } }

>  

>  ##

>  # @trace-event-get-state:

> diff --git a/trace/qmp.c b/trace/qmp.c

> index ea99b00956..cce8198091 100644

> --- a/trace/qmp.c

> +++ b/trace/qmp.c

> @@ -102,6 +102,7 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name,

>          elem->value = g_new(TraceEventInfo, 1);

>          elem->value->vcpu = is_vcpu;

>          elem->value->name = g_strdup(trace_event_get_name(ev));

> +        elem->value->count = ev->count;


I suspect this converts from uint64_t to int64_t.  Change the type to
'uint64' in the QAPI schema?

>  

>          if (!trace_event_get_state_static(ev)) {

>              elem->value->state = TRACE_EVENT_STATE_UNAVAILABLE;
Dr. David Alan Gilbert Oct. 17, 2018, 11:52 a.m. UTC | #3
* Alex Bennée (alex.bennee@linaro.org) wrote:
> Now we have counts for each trace point we can expose them in the

> monitor when the user queries what trace points are available.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>


Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


> ---

>  monitor.c       | 5 +++--

>  qapi/trace.json | 3 ++-

>  trace/qmp.c     | 1 +

>  3 files changed, 6 insertions(+), 3 deletions(-)

> 

> diff --git a/monitor.c b/monitor.c

> index c4677b502b..d8229cd2b0 100644

> --- a/monitor.c

> +++ b/monitor.c

> @@ -1421,9 +1421,10 @@ static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)

>      }

>  

>      for (elem = events; elem != NULL; elem = elem->next) {

> -        monitor_printf(mon, "%s : state %u\n",

> +        monitor_printf(mon, "%s : state %u count %" PRIu64 "\n",

>                         elem->value->name,

> -                       elem->value->state == TRACE_EVENT_STATE_ENABLED ? 1 : 0);

> +                       elem->value->state == TRACE_EVENT_STATE_ENABLED ? 1 : 0,

> +                       elem->value->count);

>      }

>      qapi_free_TraceEventInfoList(events);

>  }

> diff --git a/qapi/trace.json b/qapi/trace.json

> index 799b254a18..b9184b0d18 100644

> --- a/qapi/trace.json

> +++ b/qapi/trace.json

> @@ -33,6 +33,7 @@

>  # @name: Event name.

>  # @state: Tracing state.

>  # @vcpu: Whether this is a per-vCPU event (since 2.7).

> +# @count: Current hits on trace-point (since 3.1).

>  #

>  # An event is per-vCPU if it has the "vcpu" property in the "trace-events"

>  # files.

> @@ -40,7 +41,7 @@

>  # Since: 2.2

>  ##

>  { 'struct': 'TraceEventInfo',

> -  'data': {'name': 'str', 'state': 'TraceEventState', 'vcpu': 'bool'} }

> +  'data': {'name': 'str', 'state': 'TraceEventState', 'vcpu': 'bool', 'count': 'int' } }

>  

>  ##

>  # @trace-event-get-state:

> diff --git a/trace/qmp.c b/trace/qmp.c

> index ea99b00956..cce8198091 100644

> --- a/trace/qmp.c

> +++ b/trace/qmp.c

> @@ -102,6 +102,7 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name,

>          elem->value = g_new(TraceEventInfo, 1);

>          elem->value->vcpu = is_vcpu;

>          elem->value->name = g_strdup(trace_event_get_name(ev));

> +        elem->value->count = ev->count;

>  

>          if (!trace_event_get_state_static(ev)) {

>              elem->value->state = TRACE_EVENT_STATE_UNAVAILABLE;

> -- 

> 2.17.1

> 

--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff mbox series

Patch

diff --git a/monitor.c b/monitor.c
index c4677b502b..d8229cd2b0 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1421,9 +1421,10 @@  static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)
     }
 
     for (elem = events; elem != NULL; elem = elem->next) {
-        monitor_printf(mon, "%s : state %u\n",
+        monitor_printf(mon, "%s : state %u count %" PRIu64 "\n",
                        elem->value->name,
-                       elem->value->state == TRACE_EVENT_STATE_ENABLED ? 1 : 0);
+                       elem->value->state == TRACE_EVENT_STATE_ENABLED ? 1 : 0,
+                       elem->value->count);
     }
     qapi_free_TraceEventInfoList(events);
 }
diff --git a/qapi/trace.json b/qapi/trace.json
index 799b254a18..b9184b0d18 100644
--- a/qapi/trace.json
+++ b/qapi/trace.json
@@ -33,6 +33,7 @@ 
 # @name: Event name.
 # @state: Tracing state.
 # @vcpu: Whether this is a per-vCPU event (since 2.7).
+# @count: Current hits on trace-point (since 3.1).
 #
 # An event is per-vCPU if it has the "vcpu" property in the "trace-events"
 # files.
@@ -40,7 +41,7 @@ 
 # Since: 2.2
 ##
 { 'struct': 'TraceEventInfo',
-  'data': {'name': 'str', 'state': 'TraceEventState', 'vcpu': 'bool'} }
+  'data': {'name': 'str', 'state': 'TraceEventState', 'vcpu': 'bool', 'count': 'int' } }
 
 ##
 # @trace-event-get-state:
diff --git a/trace/qmp.c b/trace/qmp.c
index ea99b00956..cce8198091 100644
--- a/trace/qmp.c
+++ b/trace/qmp.c
@@ -102,6 +102,7 @@  TraceEventInfoList *qmp_trace_event_get_state(const char *name,
         elem->value = g_new(TraceEventInfo, 1);
         elem->value->vcpu = is_vcpu;
         elem->value->name = g_strdup(trace_event_get_name(ev));
+        elem->value->count = ev->count;
 
         if (!trace_event_get_state_static(ev)) {
             elem->value->state = TRACE_EVENT_STATE_UNAVAILABLE;