1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +00:00

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
9 changed files with 253 additions and 201 deletions

View file

@ -1,18 +1,28 @@
#include "MemoryStatsWidget.h"
#include "GraphWidget.h"
#include <AK/JsonObject.h>
#include <LibDraw/StylePainter.h>
#include <LibGUI/GBoxLayout.h>
#include <LibGUI/GLabel.h>
#include <LibGUI/GPainter.h>
#include <LibDraw/StylePainter.h>
#include <stdio.h>
#include <stdlib.h>
static MemoryStatsWidget* s_the;
MemoryStatsWidget* MemoryStatsWidget::the()
{
return s_the;
}
MemoryStatsWidget::MemoryStatsWidget(GraphWidget& graph, GWidget* parent)
: GWidget(parent)
, m_graph(graph)
, m_proc_memstat(CFile::construct("/proc/memstat"))
{
ASSERT(!s_the);
s_the = this;
if (!m_proc_memstat->open(CIODevice::OpenMode::ReadOnly))
ASSERT_NOT_REACHED();
set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);