Add 'Requested MEM' column (aka prefmem) (#788)
This commit is contained in:
parent
55d5bf0262
commit
227597cf93
@ -118,7 +118,7 @@
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>15</number>
|
||||
<number>17</number>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||
<bool>false</bool>
|
||||
@ -217,6 +217,16 @@
|
||||
<string>Memory usage graph</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Req MEM</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Req MEM Graph</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Size</string>
|
||||
@ -280,6 +290,8 @@
|
||||
<addaction name="action_cpu_graph"/>
|
||||
<addaction name="action_mem"/>
|
||||
<addaction name="action_mem_graph"/>
|
||||
<addaction name="action_prefmem"/>
|
||||
<addaction name="action_prefmem_graph"/>
|
||||
<addaction name="action_size_on_disk"/>
|
||||
<addaction name="action_internal"/>
|
||||
<addaction name="action_ip"/>
|
||||
@ -879,6 +891,28 @@
|
||||
<string>Last backup</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_prefmem">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Requested MEM</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_prefmem_graph">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Requested MEM Graph</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
|
@ -122,6 +122,7 @@ class QubesManagerFileWatcher(ProcessEvent):
|
||||
class VmRowInTable(object):
|
||||
cpu_graph_hue = 210
|
||||
mem_graph_hue = 120
|
||||
prefmem_graph_hue = 70
|
||||
|
||||
def __init__(self, vm, row_no, table, block_manager):
|
||||
self.vm = vm
|
||||
@ -169,6 +170,28 @@ class VmRowInTable(object):
|
||||
table.setCellWidget(row_no, VmManagerWindow.columns_indices['MEM Graph'], self.mem_widget)
|
||||
table.setItem(row_no, VmManagerWindow.columns_indices['MEM Graph'], self.mem_widget.tableItem)
|
||||
|
||||
self.prefmem_usage_widget = VmUsageBarWidget(0, qubes_host.memory_total/1024, "%v MB",
|
||||
lambda vm, val: vm.last_prefmem/1024, vm, 0,
|
||||
self.prefmem_graph_hue)
|
||||
table.setCellWidget(row_no,
|
||||
VmManagerWindow.columns_indices['Req MEM'],
|
||||
self.prefmem_usage_widget)
|
||||
table.setItem(row_no,
|
||||
VmManagerWindow.columns_indices['Req MEM'],
|
||||
self.prefmem_usage_widget.tableItem)
|
||||
|
||||
self.prefmem_widget = \
|
||||
ChartWidget(vm,
|
||||
lambda vm, val: vm .last_prefmem*100/qubes_host\
|
||||
.memory_total, self.prefmem_graph_hue, 0)
|
||||
table.setCellWidget(row_no,
|
||||
VmManagerWindow.columns_indices['Req MEM Graph'],
|
||||
self.prefmem_widget)
|
||||
table.setItem(row_no,
|
||||
VmManagerWindow.columns_indices['Req MEM Graph'],
|
||||
self.prefmem_widget.tableItem)
|
||||
|
||||
|
||||
self.size_widget = VmSizeOnDiskItem(vm)
|
||||
table.setItem(row_no, VmManagerWindow.columns_indices['Size'], self.size_widget)
|
||||
|
||||
@ -193,6 +216,8 @@ class VmRowInTable(object):
|
||||
self.mem_usage_widget.update_load(self.vm, None)
|
||||
self.load_widget.update_load(self.vm, cpu_load)
|
||||
self.mem_widget.update_load(self.vm, None)
|
||||
self.prefmem_widget.update_load(self.vm, None)
|
||||
self.prefmem_usage_widget.update_load(self.vm, None)
|
||||
if update_size_on_disk == True:
|
||||
self.size_widget.update()
|
||||
|
||||
@ -240,11 +265,13 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
"CPU Graph": 7,
|
||||
"MEM": 8,
|
||||
"MEM Graph": 9,
|
||||
"Size": 10,
|
||||
"Internal": 11,
|
||||
"IP": 12,
|
||||
"Backups": 13,
|
||||
"Last backup": 14,
|
||||
"Req MEM": 10,
|
||||
"Req MEM Graph": 11,
|
||||
"Size": 12,
|
||||
"Internal": 13,
|
||||
"IP": 14,
|
||||
"Backups": 15,
|
||||
"Last backup": 16,
|
||||
}
|
||||
|
||||
def __init__(self, parent=None):
|
||||
@ -256,9 +283,11 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
|
||||
self.qubes_watch = qubesutils.QubesWatch()
|
||||
self.qvm_collection = QubesVmCollection()
|
||||
self.meminfo_changed = {}
|
||||
self.blk_manager = QubesBlockDevicesManager(self.qvm_collection)
|
||||
self.blk_manager.tray_message_func = trayIcon.showMessage
|
||||
self.qubes_watch.setup_block_watch(self.blk_manager.block_devs_event)
|
||||
self.qubes_watch.setup_meminfo_watch(self.meminfo_update_event)
|
||||
self.blk_watch_thread = threading.Thread(target=self.qubes_watch.watch_loop)
|
||||
self.blk_watch_thread.daemon = True
|
||||
self.blk_watch_thread.start()
|
||||
@ -298,6 +327,10 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
self.columns_actions[ self.columns_indices["CPU Graph"] ] = self.action_cpu_graph
|
||||
self.columns_actions[ self.columns_indices["MEM"] ] = self.action_mem
|
||||
self.columns_actions[ self.columns_indices["MEM Graph"] ] = self.action_mem_graph
|
||||
self.columns_actions[ self.columns_indices["Req MEM"] ] = self\
|
||||
.action_prefmem
|
||||
self.columns_actions[ self.columns_indices["Req MEM Graph"] ] = self\
|
||||
.action_prefmem_graph
|
||||
self.columns_actions[ self.columns_indices["Size"] ] = self.action_size_on_disk
|
||||
self.columns_actions[ self.columns_indices["Internal"] ] = self.action_internal
|
||||
self.columns_actions[ self.columns_indices["IP"] ] = self\
|
||||
@ -314,6 +347,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
self.action_cpu_graph.setChecked(False)
|
||||
self.table.setColumnHidden( self.columns_indices["MEM Graph"], True)
|
||||
self.action_mem_graph.setChecked(False)
|
||||
self.action_prefmem.setChecked(False)
|
||||
self.action_prefmem_graph.setChecked(False)
|
||||
self.table.setColumnHidden( self.columns_indices["Size"], True)
|
||||
self.action_size_on_disk.setChecked(False)
|
||||
self.table.setColumnHidden( self.columns_indices["Internal"], True)
|
||||
@ -522,6 +557,7 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
for vm in vms_list:
|
||||
vm.last_power_state = vm.get_power_state()
|
||||
vm.last_running = vm.last_power_state in ["Running", "Transient"]
|
||||
vm.last_prefmem = vm.get_prefmem()
|
||||
if vm.last_running:
|
||||
running_count += 1
|
||||
if vm.internal:
|
||||
@ -591,6 +627,9 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
self.table.setRowHidden(row_no, False)
|
||||
row_no += 1
|
||||
|
||||
def meminfo_update_event(self, domain_id):
|
||||
self.meminfo_changed[int(domain_id)] = True
|
||||
|
||||
def mark_table_for_update(self):
|
||||
self.reload_table = True
|
||||
|
||||
@ -633,6 +672,9 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
"Error starting VM: Cannot execute qrexec-daemon!" \
|
||||
and vm.is_qrexec_running():
|
||||
self.clear_error(vm.qid)
|
||||
if self.meminfo_changed.get(vm.xid, True):
|
||||
vm.last_prefmem = vm.get_prefmem()
|
||||
self.meminfo_changed[vm.xid] = False
|
||||
|
||||
if self.screen_changed == True:
|
||||
reload_table = True
|
||||
@ -1355,6 +1397,12 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
|
||||
def on_action_mem_graph_toggled(self, checked):
|
||||
self.showhide_column( self.columns_indices['MEM Graph'], checked)
|
||||
|
||||
def on_action_prefmem_toggled(self, checked):
|
||||
self.showhide_column( self.columns_indices['Req MEM'], checked)
|
||||
|
||||
def on_action_prefmem_graph_toggled(self, checked):
|
||||
self.showhide_column( self.columns_indices['Req MEM Graph'], checked)
|
||||
|
||||
def on_action_size_on_disk_toggled(self, checked):
|
||||
self.showhide_column( self.columns_indices['Size'], checked)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user