def testStartStop(self): """Tests the Start and Stop functions.""" profiling_configuration = configurations.ProfilingConfiguration() with shared_test_lib.TempDirectory() as temp_directory: profiling_configuration.directory = temp_directory test_profiler = profilers.SampleFileProfiler( 'test', profiling_configuration) test_profiler._FILE_HEADER = 'test' test_profiler.Start() test_profiler.Stop()
def testSample(self): """Tests the Sample function.""" profiling_configuration = configurations.ProfilingConfiguration() with shared_test_lib.TempDirectory() as temp_directory: profiling_configuration.directory = temp_directory test_profiler = profilers.TasksProfiler('test', profiling_configuration) test_profiler.Start() for _ in range(5): task = tasks.Task() test_profiler.Sample(task, 'queued') time.sleep(0.01) test_profiler.Stop()
def testSample(self): """Tests the Sample function.""" profiling_configuration = configurations.ProfilingConfiguration() with shared_test_lib.TempDirectory() as temp_directory: profiling_configuration.directory = temp_directory test_profiler = profilers.StorageProfiler( 'test', profiling_configuration) test_profiler.Start() for _ in range(5): test_profiler.Sample('read', 'test', 1024, 128) time.sleep(0.01) test_profiler.Stop()
def testStartStopTiming(self): """Tests the StartTiming and StopTiming functions.""" profiling_configuration = configurations.ProfilingConfiguration() with shared_test_lib.TempDirectory() as temp_directory: profiling_configuration.directory = temp_directory test_profiler = profilers.CPUTimeProfiler( 'test', profiling_configuration) test_profiler.Start() for _ in range(5): test_profiler.StartTiming('test_profile') time.sleep(0.01) test_profiler.StopTiming('test_profile') test_profiler.Stop()
def testSample(self): """Tests the Sample function.""" task_status = processing_status.TasksStatus() profiling_configuration = configurations.ProfilingConfiguration() with shared_test_lib.TempDirectory() as temp_directory: profiling_configuration.directory = temp_directory test_profiler = profilers.TaskQueueProfiler( 'test', profiling_configuration) test_profiler.Start() for _ in range(5): test_profiler.Sample(task_status) time.sleep(0.01) test_profiler.Stop()
def testStartSampleStop(self): """Tests the Start, Sample and Stop functions.""" self.assertTrue(profilers.GuppyMemoryProfiler.IsSupported()) profiling_configuration = configurations.ProfilingConfiguration() with shared_test_lib.TempDirectory() as temp_directory: profiling_configuration.directory = temp_directory profiling_configuration.sample_rate = 1000 test_profiler = profilers.GuppyMemoryProfiler( 'test', profiling_configuration) test_profiler.Start() for _ in range(5): test_profiler.Sample() time.sleep(0.01) test_profiler.Stop()
def testHaveProfileTasks(self): """Tests the HaveProfileTasks function.""" configuration = configurations.ProfilingConfiguration() self.assertFalse(configuration.HaveProfileTasks())
def testInitialization(self): """Tests the __init__ function.""" configuration = configurations.ProfilingConfiguration() self.assertIsNotNone(configuration)