//===-- Statistics.h --------------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLDB_TARGET_STATISTICS_H #define LLDB_TARGET_STATISTICS_H #include "lldb/DataFormatters/TypeSummary.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/RealpathPrefixes.h" #include "lldb/Utility/Stream.h" #include "lldb/lldb-forward.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/JSON.h" #include <atomic> #include <chrono> #include <mutex> #include <optional> #include <ratio> #include <string> #include <vector> namespace lldb_private { StatsClock; StatsTimepoint; class SummaryStatistics; // Declaring here as there is no private forward SummaryStatisticsSP; class StatsDuration { … }; /// A class that measures elapsed time in an exception safe way. /// /// This is a RAII class is designed to help gather timing statistics within /// LLDB where objects have optional Duration variables that get updated with /// elapsed times. This helps LLDB measure statistics for many things that are /// then reported in LLDB commands. /// /// Objects that need to measure elapsed times should have a variable of type /// "StatsDuration m_time_xxx;" which can then be used in the constructor of /// this class inside a scope that wants to measure something: /// /// ElapsedTime elapsed(m_time_xxx); /// // Do some work /// /// This class will increment the m_time_xxx variable with the elapsed time /// when the object goes out of scope. The "m_time_xxx" variable will be /// incremented when the class goes out of scope. This allows a variable to /// measure something that might happen in stages at different times, like /// resolving a breakpoint each time a new shared library is loaded. class ElapsedTime { … }; /// A class to count success/fail statistics. struct StatsSuccessFail { … }; /// A class that represents statistics for a since lldb_private::Module. struct ModuleStats { … }; struct ConstStringStats { … }; struct StatisticsOptions { … }; /// A class that represents statistics about a TypeSummaryProviders invocations /// \note All members of this class need to be accessed in a thread safe manner class SummaryStatistics { … }; /// A class that wraps a std::map of SummaryStatistics objects behind a mutex. class SummaryStatisticsCache { … }; /// A class that represents statistics for a since lldb_private::Target. class TargetStats { … }; class DebuggerStats { … }; } // namespace lldb_private #endif // LLDB_TARGET_STATISTICS_H