SystemMonitor: Make all tabs except the process table lazily loaded

We now use GLazyWidget for all the secondary tabs, which makes the
program start up way faster than before.

There's a noticeable delay when you click on the "PCI Devices" tab
for the first time, but that's definitely better than always eating
that delay before seeing a window at all. :^)
This commit is contained in:
Andreas Kling 2019-10-02 20:26:19 +02:00
parent 183f7c9830
commit 9da121f837
Notes: sideshowbarker 2024-07-19 11:51:15 +09:00
9 changed files with 253 additions and 201 deletions

View file

@ -8,9 +8,18 @@
#include <fcntl.h>
#include <stdio.h>
ProcessModel::ProcessModel(GraphWidget& graph)
: m_graph(graph)
static ProcessModel* s_the;
ProcessModel& ProcessModel::the()
{
ASSERT(s_the);
return *s_the;
}
ProcessModel::ProcessModel()
{
ASSERT(!s_the);
s_the = this;
m_generic_process_icon = GraphicsBitmap::load_from_file("/res/icons/gear16.png");
m_high_priority_icon = GraphicsBitmap::load_from_file("/res/icons/highpriority16.png");
m_low_priority_icon = GraphicsBitmap::load_from_file("/res/icons/lowpriority16.png");
@ -263,7 +272,8 @@ void ProcessModel::update()
for (auto pid : pids_to_remove)
m_processes.remove(pid);
m_graph.add_value(total_cpu_percent);
if (on_new_cpu_data_point)
on_new_cpu_data_point(total_cpu_percent);
did_update();
}