mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:32:45 +00:00 
			
		
		
		
	ProcessManager: Add a process-specific tab view below the process table.
To start out, add a "Stacks" view where we see what the selected process is currently doing (via /proc/PID/stack) :^)
This commit is contained in:
		
							parent
							
								
									c452528952
								
							
						
					
					
						commit
						9b7e1eb287
					
				
					 4 changed files with 73 additions and 1 deletions
				
			
		
							
								
								
									
										38
									
								
								Applications/ProcessManager/ProcessStacksWidget.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								Applications/ProcessManager/ProcessStacksWidget.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | |||
| #include "ProcessStacksWidget.h" | ||||
| #include <LibCore/CFile.h> | ||||
| #include <LibCore/CTimer.h> | ||||
| #include <LibGUI/GBoxLayout.h> | ||||
| 
 | ||||
| ProcessStacksWidget::ProcessStacksWidget(GWidget* parent) | ||||
|     : GWidget(parent) | ||||
| { | ||||
|     set_layout(make<GBoxLayout>(Orientation::Vertical)); | ||||
|     layout()->set_margins({ 4, 4, 4, 4 }); | ||||
|     m_stacks_editor = new GTextEditor(GTextEditor::Type::MultiLine, this); | ||||
|     m_stacks_editor->set_readonly(true); | ||||
| 
 | ||||
|     m_timer = new CTimer(1000, [this] { refresh(); }); | ||||
| } | ||||
| 
 | ||||
| ProcessStacksWidget::~ProcessStacksWidget() | ||||
| { | ||||
| } | ||||
| 
 | ||||
| void ProcessStacksWidget::set_pid(pid_t pid) | ||||
| { | ||||
|     if (m_pid == pid) | ||||
|         return; | ||||
|     m_pid = pid; | ||||
|     refresh(); | ||||
| } | ||||
| 
 | ||||
| void ProcessStacksWidget::refresh() | ||||
| { | ||||
|     CFile file(String::format("/proc/%d/stack", m_pid)); | ||||
|     if (!file.open(CIODevice::ReadOnly)) { | ||||
|         m_stacks_editor->set_text(String::format("Unable to open %s", file.filename().characters())); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     m_stacks_editor->set_text(file.read_all()); | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling