summaryrefslogtreecommitdiff
path: root/DevTools/HackStudio/ProcessStateWidget.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-10-24 20:21:43 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-10-24 20:21:43 +0200
commit272317bce27b9def41d0b5f53931bf90abb0bcba (patch)
tree9d4a8bff0ce1ff1346a783eb3d4c2b3fab7e1b07 /DevTools/HackStudio/ProcessStateWidget.h
parent489e451ccef8c74f521fe1bb84c9f55b11aadd66 (diff)
downloadserenity-272317bce27b9def41d0b5f53931bf90abb0bcba.zip
HackStudio: Add a widget showing the state of console's running process
We now have a little widget that sits above the terminal view in the build/application console. When a child process is running, we show its PID, name, scheduling counter, and amount of resident memory in a live little overview. This is not working right just yet, since we don't know how to get to the actually active PID on the TTY. Or, well, we find the active PID by looking at the PGID of our fork()ed child. This manages to find children spawned by Shell, but not children spawned by make, for instance. I need to figure out how to find those.
Diffstat (limited to 'DevTools/HackStudio/ProcessStateWidget.h')
-rw-r--r--DevTools/HackStudio/ProcessStateWidget.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/DevTools/HackStudio/ProcessStateWidget.h b/DevTools/HackStudio/ProcessStateWidget.h
new file mode 100644
index 0000000000..5f9c35c0c0
--- /dev/null
+++ b/DevTools/HackStudio/ProcessStateWidget.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#include <LibGUI/GWidget.h>
+
+class CTimer;
+class GLabel;
+
+class ProcessStateWidget final : public GWidget {
+ C_OBJECT(ProcessStateWidget)
+public:
+ virtual ~ProcessStateWidget() override;
+
+ void set_pid(pid_t);
+
+private:
+ explicit ProcessStateWidget(GWidget* parent);
+
+ void refresh();
+
+ RefPtr<GLabel> m_pid_label;
+ RefPtr<GLabel> m_state_label;
+ RefPtr<GLabel> m_cpu_label;
+ RefPtr<GLabel> m_memory_label;
+
+ RefPtr<CTimer> m_timer;
+
+ pid_t m_pid { -1 };
+};