public void verify_NodeCount_is_one_for_tree_with_single_node() { ThreadProfilingBucket bucket = new ThreadProfilingBucket(new MockThreadProfilingService()); var fids = GenerateStackSnapshot(1, 200, 50); bucket.UpdateTree(fids); Assert.AreEqual(1, bucket.GetNodeCount()); }
private void verify_depth_after_calling_UpdateTree(uint numFunctionIds) { ThreadProfilingBucket bucket = new ThreadProfilingBucket(new MockThreadProfilingService()); var fids = GenerateStackSnapshot(numFunctionIds, 200, 50); bucket.UpdateTree(fids); Assert.AreEqual(fids.Count(), bucket.GetDepth()); }
public void verify_UpdateTree_handles_null_StackInfo_argument() { using (var logging = new TestUtilities.Logging()) { ThreadProfilingBucket bucket = new ThreadProfilingBucket(new MockThreadProfilingService()); bucket.UpdateTree(null); Assert.IsTrue(logging.HasMessageBeginingWith("fids passed to UpdateTree is null")); } }
public void verify_NodeCount_for_tree_with_twenty_nodes() { uint numNodes = 20; ThreadProfilingBucket bucket = new ThreadProfilingBucket(new MockThreadProfilingService()); var fids = GenerateStackSnapshot(numNodes, 200, 50); bucket.UpdateTree(fids); Assert.AreEqual(numNodes, bucket.GetNodeCount()); }
public ThreadProfilingService(IDataTransportService dataTransportService, INativeMethods nativeMethods, int maxAggregatedNodes = 20000) { _dataTransportService = dataTransportService; _maxAggregatedNodes = maxAggregatedNodes; _nativeMethods = nativeMethods; _threadProfilingBucket = new ThreadProfilingBucket(this); PruningList = new ArrayList(); }
public void verify_ResetCache_clears_all_buckets() { ThreadProfilingService service = new ThreadProfilingService(null, null); ThreadProfilingBucket bucket = new ThreadProfilingBucket(service); var fids = GenerateStackSnapshot(10, 200, 50); bucket.UpdateTree(fids); service.ResetCache(); Assert.AreEqual(0, service.GetTotalBucketNodeCount()); }
public void verify_NodeCount_for_tree_with_several_multiple_node_stacks_of_diff_depths() { ThreadProfilingBucket bucket = new ThreadProfilingBucket(new MockThreadProfilingService()); for (uint i = 5; i < 30; i += 5) { var fids = GenerateStackSnapshot(i, 200, 50, true); bucket.UpdateTree(fids); } // Total node count should be equal to 5 + 10 + 15 + 20 + 25 = 75 Assert.AreEqual(75, bucket.GetNodeCount()); }
private void verify_depth_after_multiple__identical_calls_to_UpdateTree(int numCalls, int numFunctionIds) { // This function verifies that the depth hasn't been changed when identical stacks are added to the tree. ThreadProfilingBucket bucket = new ThreadProfilingBucket(new MockThreadProfilingService()); var fids = GenerateStackSnapshot(10, 200, 50); // Use the exact same stack information to update tree multiple times. // This should result in the tree's depth not changing after the first call. for (int i = 0; i < numCalls; i++) { bucket.UpdateTree(fids); } Assert.AreEqual(fids.Count(), bucket.GetDepth()); }
private void verify_CallCount_after_multiple_calls_to_UpdateTree(int numCalls, int numFunctionIds) { ThreadProfilingBucket bucket = new ThreadProfilingBucket(new MockThreadProfilingService()); var fids = GenerateStackSnapshot(10, 200, 50); // Use the exact same stack information to update tree multiple times. // This should result in each function's call count being equal to the number // of times we update the tree. for (int i = 0; i < numCalls; i++) { // Don't normally reuse a StackInfo but if we do then we need to reset the CurrentIndex // since it is decremented by UpdateTree. Good candidate for a refactor. bucket.UpdateTree(fids.Take(numFunctionIds - 1).ToArray()); } verify_all_function_CallCounts_match_a_value(bucket, numCalls); }
public void verify_root_node_has_Depth_of_Zero_on_construction() { ThreadProfilingBucket bucket = new ThreadProfilingBucket(new MockThreadProfilingService()); Assert.AreEqual(0, bucket.Tree.Root.Depth); }
public void verify_root_node_has_CallCount_of_Zero_on_construction() { ThreadProfilingBucket bucket = new ThreadProfilingBucket(new MockThreadProfilingService()); Assert.AreEqual(0, bucket.Tree.Root.RunnableCount); }
public void verify_root_node_created_on_construction() { ThreadProfilingBucket bucket = new ThreadProfilingBucket(new MockThreadProfilingService()); Assert.IsNotNull(bucket.Tree); }
private void verify_all_function_CallCounts_match_a_value(ThreadProfilingBucket bucket, int expectedCallCount) { recurse_validate_call_count_for_all(bucket.Tree.Root.Children, expectedCallCount); }
public void verify_NodeCount_is_zero_for_empty_tree() { ThreadProfilingBucket bucket = new ThreadProfilingBucket(new MockThreadProfilingService()); Assert.AreEqual(0, bucket.GetNodeCount()); }