Example #1
0
        public void verify_if_sample_period_argument_missing_that_max_frequency_in_msec_set_to_default()
        {
            Dictionary <string, object> arguments = new Dictionary <string, object>();

            arguments.Add("profile_id", 4444);
            arguments.Add("duration", 180.0);
            arguments.Add("only_runnable_threads", false);
            arguments.Add("only_request_threads", false);
            arguments.Add("profile_agent_code", false);

            MockThreadProfilingService service = new MockThreadProfilingService();
            StartThreadProfilerCommand command = new StartThreadProfilerCommand(service);
            object response = command.Process(arguments);

            Assert.AreEqual(ThreadProfilerCommandArgs.DefaultSamplingFrequencySeconds * 1000, service.Frequency);
        }
Example #2
0
        public void verify_duration_argument_overflow_converts_to_max_duration_in_msec()
        {
            Dictionary <string, object> arguments = new Dictionary <string, object>();

            arguments.Add("profile_id", 4444);
            arguments.Add("sample_period", 0.1);
            arguments.Add("duration", 999999999999999999);
            arguments.Add("only_runnable_threads", false);
            arguments.Add("only_request_threads", false);
            arguments.Add("profile_agent_code", false);

            MockThreadProfilingService service = new MockThreadProfilingService();
            StartThreadProfilerCommand command = new StartThreadProfilerCommand(service);
            object response = command.Process(arguments);

            Assert.AreEqual(ThreadProfilerCommandArgs.MaximumSamplingDurationSeconds * 1000, service.Duration);
        }
Example #3
0
        public void verify_duration_argument_equal_to_10_minutes_converts_correctly_to_duration_in_msec()
        {
            Dictionary <string, object> arguments = new Dictionary <string, object>();

            arguments.Add("profile_id", 4444);
            arguments.Add("sample_period", 0.1);
            arguments.Add("duration", 600.00);
            arguments.Add("only_runnable_threads", false);
            arguments.Add("only_request_threads", false);
            arguments.Add("profile_agent_code", false);

            MockThreadProfilingService service = new MockThreadProfilingService();
            StartThreadProfilerCommand command = new StartThreadProfilerCommand(service);
            object response = command.Process(arguments);

            Assert.AreEqual(600000, service.Duration);
        }
Example #4
0
        public void verify_sample_period_argument_equal_to_less_than_1_second_sample_converts_correctly_to_frequency_in_msec()
        {
            Dictionary <string, object> arguments = new Dictionary <string, object>();

            arguments.Add("profile_id", 4444);
            arguments.Add("sample_period", 0.91);
            arguments.Add("duration", 180.0);
            arguments.Add("only_runnable_threads", false);
            arguments.Add("only_request_threads", false);
            arguments.Add("profile_agent_code", false);

            MockThreadProfilingService service = new MockThreadProfilingService();
            StartThreadProfilerCommand command = new StartThreadProfilerCommand(service);
            object response = command.Process(arguments);

            Assert.AreEqual(910, service.Frequency);
        }