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: Ie81f13a96502236bdfa7fc537e8fa3a10481cf36
Bug-Url: https://bugzilla.redhat.com/1078897
Signed-off-by: Shirly Radco <sra...@redhat.com>
---
M packaging/dbscripts/create_dwh_views.sql
1 file changed, 15 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/83/27683/1

diff --git a/packaging/dbscripts/create_dwh_views.sql 
b/packaging/dbscripts/create_dwh_views.sql
index de43633..1dcfa0b 100644
--- a/packaging/dbscripts/create_dwh_views.sql
+++ b/packaging/dbscripts/create_dwh_views.sql
@@ -269,8 +269,16 @@
        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 +289,11 @@
                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
+       LEFT OUTER JOIN
+               vm_statistics c ON  c.vm_guid = b.vm_guid
+       INNER JOIN
+               vm_static ON 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/27683
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie81f13a96502236bdfa7fc537e8fa3a10481cf36
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Shirly Radco <sra...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to