[Lldb-commits] [lldb] [LLDB][Data Formatters] Calculate average and total time for summary providers within lldb (PR #102708)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 12 10:48:28 PDT 2024


================
@@ -918,3 +920,24 @@ def test_order_of_options_do_not_matter(self):
                 debug_stats_1,
                 f"The order of options '{options[0]}' and '{options[1]}' should not matter",
             )
+    
+    def test_summary_statistics_providers(self):
+        """
+        Test summary timing statistics is included in statistics dump when 
+        a type with a summary provider exists, and is evaluated.
+        """
+
+        self.build()
+        target = self.createTestTarget()
+        lldbutil.run_to_source_breakpoint(
+            self, "// stop here", lldb.SBFileSpec("main.cpp")
+        )
+        self.expect("frame var", substrs=["hello world"])
+        stats = self.get_target_stats(self.get_stats())
+        self.assertIn("summaryProviderStatistics", stats)
+        summary_providers = stats["summaryProviderStatistics"]
+        # We don't want to take a dependency on the type name, so we just look
+        # for string and that it was called once.
+        summary_provider_str = str(summary_providers)
+        self.assertIn("string", summary_provider_str)
+        self.assertIn("'invocationCount': 1", summary_provider_str)
----------------
clayborg wrote:

I would do at least 2 different summary providers in the test to ensure they both get emitted and check for all key/value pairs that are expected. See suggested code changes below, we need to make sure we count the number of summary provider invocations by summary provider name, not by variable typename. We should also test `std::vector` with two different types and make sure that the summary catches both in the same entry.

https://github.com/llvm/llvm-project/pull/102708


More information about the lldb-commits mailing list