get sampler working under windows
							parent
							
								
									252915a37c
								
							
						
					
					
						commit
						d9afe92c97
					
				| 
						 | 
				
			
			@ -390,6 +390,9 @@ void factor_vm::factorbug()
 | 
			
		|||
		exit(1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (sampling_profiler_p)
 | 
			
		||||
		end_sampling_profiler();
 | 
			
		||||
 | 
			
		||||
	fep_p = true;
 | 
			
		||||
 | 
			
		||||
	std::cout << "Starting low level debugger..." << std::endl;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -312,7 +312,7 @@ void factor_vm::sampler_thread_loop()
 | 
			
		|||
	assert(QueryPerformanceCounter(&counter));
 | 
			
		||||
	while (FACTOR_MEMORY_BARRIER(), sampling_profiler_p)
 | 
			
		||||
	{
 | 
			
		||||
		Sleep(0);
 | 
			
		||||
		SwitchToThread();
 | 
			
		||||
		assert(QueryPerformanceCounter(&new_counter));
 | 
			
		||||
		cell samples = 0;
 | 
			
		||||
		while (new_counter.QuadPart - counter.QuadPart > units_per_sample) {
 | 
			
		||||
| 
						 | 
				
			
			@ -320,6 +320,7 @@ void factor_vm::sampler_thread_loop()
 | 
			
		|||
			++samples;
 | 
			
		||||
			counter.QuadPart += units_per_sample;
 | 
			
		||||
		}
 | 
			
		||||
		if (samples > 0)
 | 
			
		||||
			enqueue_safepoint_sample(samples, 0, false);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -344,6 +345,8 @@ void factor_vm::start_sampling_profiler_timer()
 | 
			
		|||
 | 
			
		||||
void factor_vm::end_sampling_profiler_timer()
 | 
			
		||||
{
 | 
			
		||||
	sampling_profiler_p = false;
 | 
			
		||||
	FACTOR_MEMORY_BARRIER();
 | 
			
		||||
	DWORD wait_result = WaitForSingleObject(sampler_thread,
 | 
			
		||||
		3000/FACTOR_PROFILE_SAMPLES_PER_SECOND);
 | 
			
		||||
	if (wait_result != WAIT_OBJECT_0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -92,6 +92,8 @@ void factor_vm::start_sampling_profiler()
 | 
			
		|||
{
 | 
			
		||||
	safepoint_sample_count = 0;
 | 
			
		||||
	safepoint_gc_sample_count = 0;
 | 
			
		||||
	safepoint_foreign_sample_count = 0;
 | 
			
		||||
	safepoint_foreign_thread_sample_count = 0;
 | 
			
		||||
	clear_samples();
 | 
			
		||||
	samples.reserve(10*FACTOR_PROFILE_SAMPLES_PER_SECOND);
 | 
			
		||||
	sample_callstacks.reserve(100*FACTOR_PROFILE_SAMPLES_PER_SECOND);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue