mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00

For users of CMake who want to optimize their scripts if they take a while to run, this commit adds the ability to output profiling data. To enable this output, it adds the two command line parameters to select the output path and format. This commit adds the first profiling format of type ``google-trace``, which is the output is a JSON file containing Duration events as per the Google Trace Format specification: https://docs.google.com/document/d/1CvAClvFfyA5R- PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#
30 lines
705 B
C++
30 lines
705 B
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
#ifndef cmMakefileProfilingData_h
|
|
#define cmMakefileProfilingData_h
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include "cmsys/FStream.hxx"
|
|
|
|
namespace Json {
|
|
class StreamWriter;
|
|
}
|
|
|
|
class cmListFileContext;
|
|
struct cmListFileFunction;
|
|
|
|
class cmMakefileProfilingData
|
|
{
|
|
public:
|
|
cmMakefileProfilingData(const std::string&);
|
|
~cmMakefileProfilingData() noexcept;
|
|
void StartEntry(const cmListFileFunction& lff, cmListFileContext const& lfc);
|
|
void StopEntry();
|
|
|
|
private:
|
|
cmsys::ofstream ProfileStream;
|
|
std::unique_ptr<Json::StreamWriter> JsonWriter;
|
|
};
|
|
#endif
|