summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileProfilingData.h
diff options
context:
space:
mode:
authorWouter Klouwen <wouter.klouwen@youview.com>2019-02-02 09:06:36 (GMT)
committerWouter Klouwen <wouter.klouwen@youview.com>2020-03-07 13:36:27 (GMT)
commit9aa4640792bd99b232abfe826b0cb0ae72f6644a (patch)
tree6d576cb085d48a0073ddc09036a7e1a2b95df2d6 /Source/cmMakefileProfilingData.h
parent8f122b45570e8357886df115d78007c4ea437daa (diff)
downloadCMake-9aa4640792bd99b232abfe826b0cb0ae72f6644a.zip
CMake-9aa4640792bd99b232abfe826b0cb0ae72f6644a.tar.gz
CMake-9aa4640792bd99b232abfe826b0cb0ae72f6644a.tar.bz2
cmake: add command line options to output script profiling data
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#
Diffstat (limited to 'Source/cmMakefileProfilingData.h')
-rw-r--r--Source/cmMakefileProfilingData.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/Source/cmMakefileProfilingData.h b/Source/cmMakefileProfilingData.h
new file mode 100644
index 0000000..1babd97
--- /dev/null
+++ b/Source/cmMakefileProfilingData.h
@@ -0,0 +1,29 @@
+/* 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