mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:42:44 +00:00 
			
		
		
		
	 01c75e3a34
			
		
	
	
		01c75e3a34
		
	
	
	
	
		
			
			There were a few cases where we could end up logging profiling events before or after the associated process or thread exists in the profile: After enabling profiling we might end up with CPU samples before we had a chance to synthesize process/thread creation events. After a thread exits we would still log associated kmalloc/kfree events. Instead we now just ignore those events.
		
			
				
	
	
		
			30 lines
		
	
	
	
		
			644 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			644 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include <Kernel/KSyms.h>
 | |
| #include <Kernel/PerformanceManager.h>
 | |
| #include <Kernel/Process.h>
 | |
| 
 | |
| namespace Kernel {
 | |
| 
 | |
| void Process::sys$exit(int status)
 | |
| {
 | |
|     {
 | |
|         ProtectedDataMutationScope scope { *this };
 | |
|         m_termination_status = status;
 | |
|         m_termination_signal = 0;
 | |
|     }
 | |
| 
 | |
|     auto* current_thread = Thread::current();
 | |
|     current_thread->set_profiling_suppressed();
 | |
|     PerformanceManager::add_thread_exit_event(*current_thread);
 | |
| 
 | |
|     die();
 | |
|     current_thread->die_if_needed();
 | |
|     VERIFY_NOT_REACHED();
 | |
| }
 | |
| 
 | |
| }
 |