================ @@ -408,3 +410,23 @@ llvm::json::Value DebuggerStats::ReportStatistics( return std::move(global_stats); } + +llvm::json::Value SummaryStatistics::ToJSON() const { + json::Object body {{ + {"invocationCount", GetSummaryCount()}, + {"totalTime", GetTotalTime()}, + {"averageTime", GetAverageTime()} + }}; + return json::Object{{GetName().AsCString(), std::move(body)}}; +} + + +json::Value SummaryStatisticsCache::ToJSON() { + m_map_mutex.lock(); ---------------- clayborg wrote:
We always want to use `std::lock_guard`. Why? Because the are exception safe. If some code anywhere throws an exception, the `std::lock_guard` will unlock the mutex. ``` std::lock_guard<std::recursive_mutex> guard(m_map_mutex); ``` https://github.com/llvm/llvm-project/pull/102708 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits