gallium,hud: add support for Hz units in driver queries
authorMarek Olšák <marek.olsak@amd.com>
Sun, 2 Aug 2015 15:06:17 +0000 (17:06 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 6 Aug 2015 18:44:36 +0000 (20:44 +0200)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/auxiliary/hud/hud_context.c
src/gallium/include/pipe/p_defines.h

index 4631cd3b323bbf63b1008f8c3cd8f9029148b5ff..e10152e69c5ae7386ad0f7e5bdb7a10a63a026ce 100644 (file)
@@ -240,6 +240,8 @@ number_to_human_readable(uint64_t num, enum pipe_driver_query_type type,
       {"", " k", " M", " G", " T", " P", " E"};
    static const char *time_units[] =
       {" us", " ms", " s"};  /* based on microseconds */
+   static const char *hz_units[] =
+      {" Hz", " KHz", " MHz", " GHz"};
    const char *suffix;
    double divisor = (type == PIPE_DRIVER_QUERY_TYPE_BYTES) ? 1024 : 1000;
    int unit = 0;
@@ -262,6 +264,10 @@ number_to_human_readable(uint64_t num, enum pipe_driver_query_type type,
       assert(unit < ARRAY_SIZE(byte_units));
       suffix = byte_units[unit];
       break;
+   case PIPE_DRIVER_QUERY_TYPE_HZ:
+      assert(unit < ARRAY_SIZE(hz_units));
+      suffix = hz_units[unit];
+      break;
    default:
       assert(unit < ARRAY_SIZE(metric_units));
       suffix = metric_units[unit];
index 68c536f11012e2147c00128366d689a37b9cf937..b124d8e4d13ca96b9f96a09dfff6c3a1e185ab12 100644 (file)
@@ -762,6 +762,7 @@ union pipe_query_result
    /* PIPE_QUERY_PRIMITIVES_GENERATED */
    /* PIPE_QUERY_PRIMITIVES_EMITTED */
    /* PIPE_DRIVER_QUERY_TYPE_UINT64 */
+   /* PIPE_DRIVER_QUERY_TYPE_HZ */
    uint64_t u64;
 
    /* PIPE_DRIVER_QUERY_TYPE_UINT */
@@ -796,6 +797,7 @@ enum pipe_driver_query_type
    PIPE_DRIVER_QUERY_TYPE_PERCENTAGE   = 3,
    PIPE_DRIVER_QUERY_TYPE_BYTES        = 4,
    PIPE_DRIVER_QUERY_TYPE_MICROSECONDS = 5,
+   PIPE_DRIVER_QUERY_TYPE_HZ           = 6,
 };
 
 enum pipe_driver_query_group_type