diff mbox

[v2,3/3] qmp/hmp: Add throttle ratio to query-migrate and info migrate

Message ID 1433267209-9882-4-git-send-email-jjherne@linux.vnet.ibm.com
State New
Headers show

Commit Message

Jason J. Herne June 2, 2015, 5:46 p.m. UTC
Report throttle ratio in info migrate and query-migrate responses when cpu
throttling is active.

Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
---
 hmp.c                 | 5 +++++
 migration/migration.c | 5 +++++
 qapi-schema.json      | 3 ++-
 3 files changed, 12 insertions(+), 1 deletion(-)

Comments

Eric Blake June 2, 2015, 8:11 p.m. UTC | #1
On 06/02/2015 11:46 AM, Jason J. Herne wrote:
> Report throttle ratio in info migrate and query-migrate responses when cpu
> throttling is active.
> 
> Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
> ---
>  hmp.c                 | 5 +++++
>  migration/migration.c | 5 +++++
>  qapi-schema.json      | 3 ++-
>  3 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/hmp.c b/hmp.c
> index e17852d..cb3c137 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -229,6 +229,11 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
>                         info->xbzrle_cache->overflow);
>      }
>  
> +    if (info->has_x_cpu_throttle_ratio) {
> +        monitor_printf(mon, "cpu throttle ratio : %0.2f\n",

s/ :/:/

How big or small can the ratio get? Is %g going to be nicer than %f if
the ratio goes through a large range of possibilities?

> +++ b/qapi-schema.json
> @@ -483,7 +483,8 @@
>             '*total-time': 'int',
>             '*expected-downtime': 'int',
>             '*downtime': 'int',
> -           '*setup-time': 'int'} }
> +           '*setup-time': 'int',
> +           '*x-cpu-throttle-ratio': 'number'} }

Even though it is marked experimental, it is still worth documenting
this parameter, and include mention of how to interpret it (0.0 means no
throttling, 1.0 means 50% duty cycle, 2.0 means 33% duty cycle, right?).
Documentation should mention '(since 2.4)'
Jason J. Herne June 3, 2015, 5:45 p.m. UTC | #2
On 06/02/2015 04:11 PM, Eric Blake wrote:
> On 06/02/2015 11:46 AM, Jason J. Herne wrote:
>> Report throttle ratio in info migrate and query-migrate responses when cpu
>> throttling is active.
>>
>> Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
>> ---
>>   hmp.c                 | 5 +++++
>>   migration/migration.c | 5 +++++
>>   qapi-schema.json      | 3 ++-
>>   3 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/hmp.c b/hmp.c
>> index e17852d..cb3c137 100644
>> --- a/hmp.c
>> +++ b/hmp.c
>> @@ -229,6 +229,11 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
>>                          info->xbzrle_cache->overflow);
>>       }
>>
>> +    if (info->has_x_cpu_throttle_ratio) {
>> +        monitor_printf(mon, "cpu throttle ratio : %0.2f\n",
>
> s/ :/:/
>

Will fix, Thanks.

> How big or small can the ratio get? Is %g going to be nicer than %f if
> the ratio goes through a large range of possibilities?
>


You are correct in your interpretation below. So a ratio of 10.0 would be
90.9% throttled. A ratio of 100 would be 99% throttled. Given that, I think
we're ok with %f.

>> +++ b/qapi-schema.json
>> @@ -483,7 +483,8 @@
>>              '*total-time': 'int',
>>              '*expected-downtime': 'int',
>>              '*downtime': 'int',
>> -           '*setup-time': 'int'} }
>> +           '*setup-time': 'int',
>> +           '*x-cpu-throttle-ratio': 'number'} }
>
> Even though it is marked experimental, it is still worth documenting
> this parameter, and include mention of how to interpret it (0.0 means no
> throttling, 1.0 means 50% duty cycle, 2.0 means 33% duty cycle, right?).
> Documentation should mention '(since 2.4)'
>

Will fix.
diff mbox

Patch

diff --git a/hmp.c b/hmp.c
index e17852d..cb3c137 100644
--- a/hmp.c
+++ b/hmp.c
@@ -229,6 +229,11 @@  void hmp_info_migrate(Monitor *mon, const QDict *qdict)
                        info->xbzrle_cache->overflow);
     }
 
+    if (info->has_x_cpu_throttle_ratio) {
+        monitor_printf(mon, "cpu throttle ratio : %0.2f\n",
+                       info->x_cpu_throttle_ratio);
+    }
+
     qapi_free_MigrationInfo(info);
     qapi_free_MigrationCapabilityStatusList(caps);
 }
diff --git a/migration/migration.c b/migration/migration.c
index c9545df..98cc03a 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -263,6 +263,11 @@  MigrationInfo *qmp_query_migrate(Error **errp)
             info->disk->total = blk_mig_bytes_total();
         }
 
+        if (cpu_throttle_active(first_cpu)) {
+            info->has_x_cpu_throttle_ratio = true;
+            info->x_cpu_throttle_ratio = cpu_throttle_get_ratio(first_cpu);
+        }
+
         get_xbzrle_cache_stats(info);
         break;
     case MIGRATION_STATUS_COMPLETED:
diff --git a/qapi-schema.json b/qapi-schema.json
index f97ffa1..5e732e0 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -483,7 +483,8 @@ 
            '*total-time': 'int',
            '*expected-downtime': 'int',
            '*downtime': 'int',
-           '*setup-time': 'int'} }
+           '*setup-time': 'int',
+           '*x-cpu-throttle-ratio': 'number'} }
 
 ##
 # @query-migrate