mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:42:43 +00:00 
			
		
		
		
	Profiler: Add ability to process read syscalls
Profiler can now process and display read events.
This commit is contained in:
		
							parent
							
								
									fae991f599
								
							
						
					
					
						commit
						cdfb388154
					
				
					 4 changed files with 28 additions and 1 deletions
				
			
		|  | @ -369,6 +369,15 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path | |||
|             if (it != current_processes.end()) | ||||
|                 it->value->handle_thread_exit(event.tid, event.serial); | ||||
|             continue; | ||||
|         } else if (type_string == "read"sv) { | ||||
|             const auto string_index = perf_event.get("filename_index"sv).to_number<FlatPtr>(); | ||||
|             event.data = Event::ReadData { | ||||
|                 .fd = perf_event.get("fd"sv).to_number<int>(), | ||||
|                 .size = perf_event.get("size"sv).to_number<size_t>(), | ||||
|                 .path = profile_strings.get(string_index).value(), | ||||
|                 .start_timestamp = perf_event.get("start_timestamp"sv).to_number<size_t>(), | ||||
|                 .success = perf_event.get("success"sv).to_bool() | ||||
|             }; | ||||
|         } else { | ||||
|             dbgln("Unknown event type '{}'", type_string); | ||||
|             VERIFY_NOT_REACHED(); | ||||
|  |  | |||
|  | @ -221,7 +221,15 @@ public: | |||
|             pid_t parent_tid {}; | ||||
|         }; | ||||
| 
 | ||||
|         Variant<std::nullptr_t, SampleData, MallocData, FreeData, SignpostData, MmapData, MunmapData, ProcessCreateData, ProcessExecData, ThreadCreateData> data { nullptr }; | ||||
|         struct ReadData { | ||||
|             int fd; | ||||
|             size_t size; | ||||
|             String path; | ||||
|             size_t start_timestamp; | ||||
|             bool success; | ||||
|         }; | ||||
| 
 | ||||
|         Variant<std::nullptr_t, SampleData, MallocData, FreeData, SignpostData, MmapData, MunmapData, ProcessCreateData, ProcessExecData, ThreadCreateData, ReadData> data { nullptr }; | ||||
|     }; | ||||
| 
 | ||||
|     Vector<Event> const& events() const { return m_events; } | ||||
|  |  | |||
|  | @ -48,6 +48,8 @@ String SamplesModel::column_name(int column) const | |||
|         return "Lost Samples"; | ||||
|     case Column::InnermostStackFrame: | ||||
|         return "Innermost Frame"; | ||||
|     case Column::Path: | ||||
|         return "Path"; | ||||
|     default: | ||||
|         VERIFY_NOT_REACHED(); | ||||
|     } | ||||
|  | @ -89,6 +91,13 @@ GUI::Variant SamplesModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol | |||
|         if (index.column() == Column::InnermostStackFrame) { | ||||
|             return event.frames.last().symbol; | ||||
|         } | ||||
| 
 | ||||
|         if (index.column() == Column::Path) { | ||||
|             if (!event.data.has<Profile::Event::ReadData>()) | ||||
|                 return ""; | ||||
|             return event.data.get<Profile::Event::ReadData>().path; | ||||
|         } | ||||
| 
 | ||||
|         return {}; | ||||
|     } | ||||
|     return {}; | ||||
|  |  | |||
|  | @ -27,6 +27,7 @@ public: | |||
|         ExecutableName, | ||||
|         LostSamples, | ||||
|         InnermostStackFrame, | ||||
|         Path, | ||||
|         __Count | ||||
|     }; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jakub Berkop
						Jakub Berkop