Shirly Radco has uploaded a new change for review.

Change subject: history: Updated calculation of cpu usage
......................................................................

history: Updated calculation of cpu usage

Updated calculations of system_cpu_usage_percent
and user_cpu_usage_percent according to the
number of cpus.

Change-Id: Idfae05895d8450e6d5f450fbf2a9e934e65a5785
Signed-off-by: Shirly Radco <[email protected]>
---
M packaging/dbscripts/create_dwh_views.sql
1 file changed, 16 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/59/27559/1

diff --git a/packaging/dbscripts/create_dwh_views.sql 
b/packaging/dbscripts/create_dwh_views.sql
index de43633..a0fc2cb 100644
--- a/packaging/dbscripts/create_dwh_views.sql
+++ b/packaging/dbscripts/create_dwh_views.sql
@@ -269,8 +269,18 @@
        cast(b.status as smallint) as vm_status,
        cast(c.usage_cpu_percent as smallint) as cpu_usage_percent,
        cast(c.usage_mem_percent as smallint) as memory_usage_percent,
-       cast(c.cpu_sys as smallint) as system_cpu_usage_percent,
-       cast(c.cpu_user as smallint) as user_cpu_usage_percent,
+       cast(
+           c.cpu_sys /
+           (vm_static.cpu_per_socket * vm_static.num_of_sockets)
+           as smallint
+           )
+       as system_cpu_usage_percent,
+       cast(
+           c.cpu_user /
+           (vm_static.cpu_per_socket * vm_static.num_of_sockets)
+           as smallint
+           )
+       as user_cpu_usage_percent,
        c.disks_usage,
        b.vm_ip,
        b.vm_fqdn,
@@ -281,9 +291,10 @@
                ELSE TRUE
        END as user_logged_in_to_guest,
        b.run_on_vds as currently_running_on_host
-FROM vm_dynamic b, vm_statistics c
-where
-       c.vm_guid = b.vm_guid;
+FROM vm_dynamic b, vm_statistics c, vm_static
+WHERE
+       c.vm_guid = b.vm_guid
+       AND c.vm_guid = vm_static.vm_guid;
 
 CREATE OR REPLACE VIEW dwh_vm_interface_configuration_history_view
 AS


-- 
To view, visit http://gerrit.ovirt.org/27559
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idfae05895d8450e6d5f450fbf2a9e934e65a5785
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shirly Radco <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to