mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 22:02:44 +00:00 
			
		
		
		
	Profiler: Add help documentation
This commit is contained in:
		
							parent
							
								
									8f867df31a
								
							
						
					
					
						commit
						0ffc06b795
					
				
					 3 changed files with 61 additions and 1 deletions
				
			
		
							
								
								
									
										47
									
								
								Base/usr/share/man/man1/Profiler.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								Base/usr/share/man/man1/Profiler.md
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,47 @@ | |||
| ## Name | ||||
| 
 | ||||
| Profiler - Serenity process profiler | ||||
| 
 | ||||
| ## Synopsis | ||||
| 
 | ||||
| ```**sh | ||||
| $ Profiler [--pid PID] [perfcore file] | ||||
| ``` | ||||
| 
 | ||||
| ## Description | ||||
| 
 | ||||
| Profiler facilitates process performance profiling and provides a GUI offering | ||||
| visual graph and tree representations to easily navigate generated profiling | ||||
| information. | ||||
| 
 | ||||
| If no arguments are provided, a window containing a list of running processes | ||||
| is presented, allowing a process to be selected for profiling. | ||||
| 
 | ||||
| Profiling information is written to `perfcore.<pid>` in the working directory | ||||
| and opened immediately for browsing following termination of profiling. | ||||
| 
 | ||||
| Profiler can also load performance information from previously created | ||||
| `perfcore` files. | ||||
| 
 | ||||
| ## Options | ||||
| 
 | ||||
| * `-p PID`, `--pid PID`: PID to profile | ||||
| 
 | ||||
| ## Examples | ||||
| 
 | ||||
| Profile running Shell process: | ||||
| 
 | ||||
| ```sh | ||||
| $ Profiler -p $(pidof Shell) | ||||
| ``` | ||||
| 
 | ||||
| Open a previously created perfcore file for browsing: | ||||
| 
 | ||||
| ```sh | ||||
| $ Profiler perfcore.123 | ||||
| ``` | ||||
| 
 | ||||
| ## See also | ||||
| 
 | ||||
| * [`perfcore`(5)](../man5/perfcore.md) | ||||
| 
 | ||||
|  | @ -7,4 +7,4 @@ set(SOURCES | |||
| ) | ||||
| 
 | ||||
| serenity_app(Profiler ICON app-profiler) | ||||
| target_link_libraries(Profiler LibGUI LibX86 LibCoreDump) | ||||
| target_link_libraries(Profiler LibGUI LibDesktop LibX86 LibCoreDump) | ||||
|  |  | |||
|  | @ -31,6 +31,7 @@ | |||
| #include <LibCore/EventLoop.h> | ||||
| #include <LibCore/ProcessStatisticsReader.h> | ||||
| #include <LibCore/Timer.h> | ||||
| #include <LibDesktop/Launcher.h> | ||||
| #include <LibGUI/Action.h> | ||||
| #include <LibGUI/Application.h> | ||||
| #include <LibGUI/BoxLayout.h> | ||||
|  | @ -80,6 +81,15 @@ int main(int argc, char** argv) | |||
|     auto& profile = profile_or_error.value(); | ||||
| 
 | ||||
|     auto window = GUI::Window::construct(); | ||||
| 
 | ||||
|     if (!Desktop::Launcher::add_allowed_handler_with_only_specific_urls( | ||||
|             "/bin/Help", | ||||
|             { URL::create_with_file_protocol("/usr/share/man/man1/Profiler.md") }) | ||||
|         || !Desktop::Launcher::seal_allowlist()) { | ||||
|         warnln("Failed to set up allowed launch URLs"); | ||||
|         return 1; | ||||
|     } | ||||
| 
 | ||||
|     window->set_title("Profiler"); | ||||
|     window->set_icon(app_icon.bitmap_for_size(16)); | ||||
|     window->resize(800, 600); | ||||
|  | @ -144,6 +154,9 @@ int main(int argc, char** argv) | |||
|     view_menu.add_action(percent_action); | ||||
| 
 | ||||
|     auto& help_menu = menubar->add_menu("Help"); | ||||
|     help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) { | ||||
|         Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/Profiler.md"), "/bin/Help"); | ||||
|     })); | ||||
|     help_menu.add_action(GUI::CommonActions::make_about_action("Profiler", app_icon, window)); | ||||
| 
 | ||||
|     app->set_menubar(move(menubar)); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Brendan Coles
						Brendan Coles