mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:32:45 +00:00 
			
		
		
		
	Kernel+Profiler: Improve profiling subsystem
This turns the perfcore format into more a log than it was before, which lets us properly log process, thread and region creation/destruction. This also makes it unnecessary to dump the process' regions every time it is scheduled like we did before. Incidentally this also fixes 'profile -c' because we previously ended up incorrectly dumping the parent's region map into the profile data. Log-based mmap support enables profiling shared libraries which are loaded at runtime, e.g. via dlopen(). This enables profiling both the parent and child process for programs which use execve(). Previously we'd discard the profiling data for the old process. The Profiler tool has been updated to not treat thread IDs as process IDs anymore. This enables support for processes with more than one thread. Also, there's a new widget to filter which process should be displayed.
This commit is contained in:
		
							parent
							
								
									f57c57966b
								
							
						
					
					
						commit
						eb798d5538
					
				
					 26 changed files with 658 additions and 292 deletions
				
			
		|  | @ -22,7 +22,7 @@ SamplesModel::~SamplesModel() | |||
| 
 | ||||
| int SamplesModel::row_count(const GUI::ModelIndex&) const | ||||
| { | ||||
|     return m_profile.filtered_event_count(); | ||||
|     return m_profile.filtered_event_indices().size(); | ||||
| } | ||||
| 
 | ||||
| int SamplesModel::column_count(const GUI::ModelIndex&) const | ||||
|  | @ -37,6 +37,8 @@ String SamplesModel::column_name(int column) const | |||
|         return "#"; | ||||
|     case Column::Timestamp: | ||||
|         return "Timestamp"; | ||||
|     case Column::ProcessID: | ||||
|         return "PID"; | ||||
|     case Column::ThreadID: | ||||
|         return "TID"; | ||||
|     case Column::ExecutableName: | ||||
|  | @ -50,7 +52,7 @@ String SamplesModel::column_name(int column) const | |||
| 
 | ||||
| GUI::Variant SamplesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const | ||||
| { | ||||
|     u32 event_index = m_profile.first_filtered_event_index() + index.row(); | ||||
|     u32 event_index = m_profile.filtered_event_indices()[index.row()]; | ||||
|     auto& event = m_profile.events().at(event_index); | ||||
| 
 | ||||
|     if (role == GUI::ModelRole::Custom) { | ||||
|  | @ -61,12 +63,14 @@ GUI::Variant SamplesModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol | |||
|         if (index.column() == Column::SampleIndex) | ||||
|             return event_index; | ||||
| 
 | ||||
|         if (index.column() == Column::ProcessID) | ||||
|             return event.pid; | ||||
| 
 | ||||
|         if (index.column() == Column::ThreadID) | ||||
|             return event.tid; | ||||
| 
 | ||||
|         if (index.column() == Column::ExecutableName) { | ||||
|             // FIXME: More abuse of the PID/TID relationship:
 | ||||
|             if (auto* process = m_profile.find_process(event.tid)) | ||||
|             if (auto* process = m_profile.find_process(event.pid, event.timestamp)) | ||||
|                 return process->executable; | ||||
|             return ""; | ||||
|         } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Gunnar Beutner
						Gunnar Beutner