aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/FileOutputBuffer.cpp
diff options
context:
space:
mode:
authorAlexandre Ganea <37383324+aganea@users.noreply.github.com>2023-10-05 22:33:58 -0400
committerGitHub <noreply@github.com>2023-10-05 22:33:58 -0400
commit356139bd027d65b6843cbd4eda642104cfe6cf8f (patch)
treece0d6466eed7506ac67a852a5b082c601a2e8e68 /llvm/lib/Support/FileOutputBuffer.cpp
parent84cbd9f4ffba17a74516d1afa442568dc54eabb1 (diff)
downloadllvm-356139bd027d65b6843cbd4eda642104cfe6cf8f.zip
llvm-356139bd027d65b6843cbd4eda642104cfe6cf8f.tar.gz
llvm-356139bd027d65b6843cbd4eda642104cfe6cf8f.tar.bz2
[LLD][COFF] Add support for `--time-trace` (#68236)
This adds support for generating Chrome-tracing .json profile traces in the LLD COFF driver. Also add the necessary time scopes, so that the profile trace shows in great detail which tasks are executed. As an example, this is what we see when linking a Unreal Engine executable: ![image](https://github.com/llvm/llvm-project/assets/37383324/b2e26eb4-9d37-4cf9-b002-48b604e7dcb7)
Diffstat (limited to 'llvm/lib/Support/FileOutputBuffer.cpp')
-rw-r--r--llvm/lib/Support/FileOutputBuffer.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Support/FileOutputBuffer.cpp b/llvm/lib/Support/FileOutputBuffer.cpp
index c11ee59..58a06a3 100644
--- a/llvm/lib/Support/FileOutputBuffer.cpp
+++ b/llvm/lib/Support/FileOutputBuffer.cpp
@@ -14,6 +14,7 @@
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Memory.h"
+#include "llvm/Support/TimeProfiler.h"
#include <system_error>
#if !defined(_MSC_VER) && !defined(__MINGW32__)
@@ -43,6 +44,8 @@ public:
size_t getBufferSize() const override { return Buffer.size(); }
Error commit() override {
+ llvm::TimeTraceScope timeScope("Commit buffer to disk");
+
// Unmap buffer, letting OS flush dirty pages to file on disk.
Buffer.unmap();