From 356139bd027d65b6843cbd4eda642104cfe6cf8f Mon Sep 17 00:00:00 2001 From: Alexandre Ganea <37383324+aganea@users.noreply.github.com> Date: Thu, 5 Oct 2023 22:33:58 -0400 Subject: [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) --- llvm/lib/Support/FileOutputBuffer.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/Support/FileOutputBuffer.cpp') 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 #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(); -- cgit v1.1