diff mbox

[v6,2/7] trace: Make trace_get_vcpu_event_count() inlinable

Message ID 148295046527.19871.6610919709371885230.stgit@fimbulvetr.bsc.es
State New
Headers show

Commit Message

Lluís Vilanova Dec. 28, 2016, 6:41 p.m. UTC
Later patches will make use of it.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 trace/control-internal.h |    5 +++++
 trace/control.c          |    9 ++-------
 trace/control.h          |    2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

Comments

Richard Henderson Jan. 10, 2017, 8:08 p.m. UTC | #1
On 12/28/2016 10:41 AM, Lluís Vilanova wrote:
> @@ -82,6 +83,10 @@ static inline bool trace_event_get_vcpu_state_dynamic(CPUState *vcpu,
>      return trace_event_get_vcpu_state_dynamic_by_vcpu_id(vcpu, vcpu_id);
>  }
>
> +static inline uint32_t trace_get_vcpu_event_count(void)
> +{
> +    return trace_next_vcpu_id;
> +}
...
> @@ -237,7 +237,7 @@ char *trace_opt_parse(const char *optarg);
>   *
>   * Return the number of known vcpu-specific events
>   */
> -uint32_t trace_get_vcpu_event_count(void);
> +static uint32_t trace_get_vcpu_event_count(void);

This second declaration should be removed.



r~
Lluís Vilanova Jan. 12, 2017, 6:14 p.m. UTC | #2
Richard Henderson writes:

> On 12/28/2016 10:41 AM, Lluís Vilanova wrote:
>> @@ -82,6 +83,10 @@ static inline bool trace_event_get_vcpu_state_dynamic(CPUState *vcpu,
>> return trace_event_get_vcpu_state_dynamic_by_vcpu_id(vcpu, vcpu_id);
>> }
>> 
>> +static inline uint32_t trace_get_vcpu_event_count(void)
>> +{
>> +    return trace_next_vcpu_id;
>> +}
> ...
>> @@ -237,7 +237,7 @@ char *trace_opt_parse(const char *optarg);
>> *
>> * Return the number of known vcpu-specific events
>> */
>> -uint32_t trace_get_vcpu_event_count(void);
>> +static uint32_t trace_get_vcpu_event_count(void);

> This second declaration should be removed.

I don't think so. "trace/control.h" contains declarations and documentation,
while "trace/control-internal.h" contains inlined implementations (something
followed by many other functions there).


Thanks,
  Lluis
diff mbox

Patch

diff --git a/trace/control-internal.h b/trace/control-internal.h
index a9d395a587..beb98a0d2c 100644
--- a/trace/control-internal.h
+++ b/trace/control-internal.h
@@ -16,6 +16,7 @@ 
 
 
 extern int trace_events_enabled_count;
+extern uint32_t trace_next_vcpu_id;
 
 
 static inline bool trace_event_is_pattern(const char *str)
@@ -82,6 +83,10 @@  static inline bool trace_event_get_vcpu_state_dynamic(CPUState *vcpu,
     return trace_event_get_vcpu_state_dynamic_by_vcpu_id(vcpu, vcpu_id);
 }
 
+static inline uint32_t trace_get_vcpu_event_count(void)
+{
+    return trace_next_vcpu_id;
+}
 
 void trace_event_register_group(TraceEvent **events);
 
diff --git a/trace/control.c b/trace/control.c
index 1a7bee6ddc..52d0e343fa 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -36,7 +36,7 @@  typedef struct TraceEventGroup {
 static TraceEventGroup *event_groups;
 static size_t nevent_groups;
 static uint32_t next_id;
-static uint32_t next_vcpu_id;
+uint32_t trace_next_vcpu_id;
 
 QemuOptsList qemu_trace_opts = {
     .name = "trace",
@@ -65,7 +65,7 @@  void trace_event_register_group(TraceEvent **events)
     for (i = 0; events[i] != NULL; i++) {
         events[i]->id = next_id++;
         if (events[i]->vcpu_id != TRACE_VCPU_EVENT_NONE) {
-            events[i]->vcpu_id = next_vcpu_id++;
+            events[i]->vcpu_id = trace_next_vcpu_id++;
         }
     }
     event_groups = g_renew(TraceEventGroup, event_groups, nevent_groups + 1);
@@ -299,8 +299,3 @@  char *trace_opt_parse(const char *optarg)
 
     return trace_file;
 }
-
-uint32_t trace_get_vcpu_event_count(void)
-{
-    return next_vcpu_id;
-}
diff --git a/trace/control.h b/trace/control.h
index ccaeac8552..80d326c4d1 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -237,7 +237,7 @@  char *trace_opt_parse(const char *optarg);
  *
  * Return the number of known vcpu-specific events
  */
-uint32_t trace_get_vcpu_event_count(void);
+static uint32_t trace_get_vcpu_event_count(void);
 
 
 #include "trace/control-internal.h"