]> Git Repo - qemu.git/commitdiff
trace: forbid floating point types
authorStefan Hajnoczi <[email protected]>
Thu, 21 Jun 2018 15:02:54 +0000 (16:02 +0100)
committerStefan Hajnoczi <[email protected]>
Wed, 27 Jun 2018 10:09:29 +0000 (11:09 +0100)
Only one existing trace event uses a floating point type.  Unfortunately
float and double cannot be supported since SystemTap does not have
floating point types.

Remove float and double from the whitelist and document this limitation.
Update the migrate_transferred trace event to use uint64_t instead of
double.

Cc: Dr. David Alan Gilbert <[email protected]>
Cc: Daniel P. BerrangĂ© <[email protected]>
Cc: Peter Maydell <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Philippe Mathieu-DaudĂ© <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Message-id: 20180621150254[email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
docs/devel/tracing.txt
migration/trace-events
qapi/trace-events
scripts/tracetool/__init__.py

index 07abbb345cb9c83e68aadd6789b9c13109587680..6f815ecbd7c64fdf49a1f0fe9d718b403a5e9ad8 100644 (file)
@@ -104,6 +104,11 @@ Trace events should use types as follows:
  * For everything else, use primitive scalar types (char, int, long) with the
    appropriate signedness.
 
+ * Avoid floating point types (float and double) because SystemTap does not
+   support them.  In most cases it is possible to round to an integer type
+   instead.  This may require scaling the value first by multiplying it by 1000
+   or the like when digits after the decimal point need to be preserved.
+
 Format strings should reflect the types defined in the trace event.  Take
 special care to use PRId64 and PRIu64 for int64_t and uint64_t types,
 respectively.  This ensures portability between 32- and 64-bit platforms.
index 3f67758893e848a947941c36741a465f29d1c156..7ea522e4535de9b73df03c8dfdf368f42e7ba501 100644 (file)
@@ -133,7 +133,7 @@ migrate_global_state_post_load(const char *state) "loaded state: %s"
 migrate_global_state_pre_save(const char *state) "saved state: %s"
 migration_thread_low_pending(uint64_t pending) "%" PRIu64
 migrate_state_too_big(void) ""
-migrate_transferred(uint64_t tranferred, uint64_t time_spent, double bandwidth, uint64_t size) "transferred %" PRIu64 " time_spent %" PRIu64 " bandwidth %g max_size %" PRId64
+migrate_transferred(uint64_t tranferred, uint64_t time_spent, uint64_t bandwidth, uint64_t size) "transferred %" PRIu64 " time_spent %" PRIu64 " bandwidth %" PRIu64 " max_size %" PRId64
 process_incoming_migration_co_end(int ret, int ps) "ret=%d postcopy-state=%d"
 process_incoming_migration_co_postcopy_end_main(void) ""
 migration_set_incoming_channel(void *ioc, const char *ioctype) "ioc=%p ioctype=%s"
index 9e9008a1dc5cdd53bc28f14ef4a3d2a0d72d72cb..70e049ea803f75cb0668d0cffca8a40689fac21d 100644 (file)
@@ -29,6 +29,6 @@ visit_type_int64(void *v, const char *name, int64_t *obj) "v=%p name=%s obj=%p"
 visit_type_size(void *v, const char *name, uint64_t *obj) "v=%p name=%s obj=%p"
 visit_type_bool(void *v, const char *name, bool *obj) "v=%p name=%s obj=%p"
 visit_type_str(void *v, const char *name, char **obj) "v=%p name=%s obj=%p"
-visit_type_number(void *v, const char *name, double *obj) "v=%p name=%s obj=%p"
+visit_type_number(void *v, const char *name, void *obj) "v=%p name=%s obj=%p"
 visit_type_any(void *v, const char *name, void *obj) "v=%p name=%s obj=%p"
 visit_type_null(void *v, const char *name, void *obj) "v=%p name=%s obj=%p"
index b20fac34a3c90ec74a84e2d1c8ad7c0c38652d51..0e3c9e146cc72e290ac80bd850762a881c8da781 100644 (file)
@@ -53,8 +53,6 @@ ALLOWED_TYPES = [
     "bool",
     "unsigned",
     "signed",
-    "float",
-    "double",
     "int8_t",
     "uint8_t",
     "int16_t",
This page took 0.027212 seconds and 4 git commands to generate.