Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: src/IceCompileServer.cpp

Issue 1781213002: Add malloc/new profiling on linux (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review fixes. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 //===- subzero/src/IceCompileServer.cpp - Compile server ------------------===// 1 //===- subzero/src/IceCompileServer.cpp - Compile server ------------------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
11 /// \brief Defines the basic commandline-based compile server. 11 /// \brief Defines the basic commandline-based compile server.
12 /// 12 ///
13 //===----------------------------------------------------------------------===// 13 //===----------------------------------------------------------------------===//
14 14
15 #include "IceCompileServer.h" 15 #include "IceCompileServer.h"
16 16
17 #include "IceClFlags.h" 17 #include "IceClFlags.h"
18 #include "IceClFlagsExtra.h" 18 #include "IceClFlagsExtra.h"
19 #include "IceELFStreamer.h" 19 #include "IceELFStreamer.h"
20 #include "IceGlobalContext.h" 20 #include "IceGlobalContext.h"
21 #include "LinuxMallocProfiling.h"
21 22
22 #ifdef __clang__ 23 #ifdef __clang__
23 #pragma clang diagnostic push 24 #pragma clang diagnostic push
24 #pragma clang diagnostic ignored "-Wunused-parameter" 25 #pragma clang diagnostic ignored "-Wunused-parameter"
25 #endif // __clang__ 26 #endif // __clang__
26 27
27 #include "llvm/Bitcode/NaCl/NaClBitcodeMungeUtils.h" 28 #include "llvm/Bitcode/NaCl/NaClBitcodeMungeUtils.h"
28 #include "llvm/Support/FileSystem.h" 29 #include "llvm/Support/FileSystem.h"
29 #include "llvm/Support/raw_os_ostream.h" 30 #include "llvm/Support/raw_os_ostream.h"
30 #include "llvm/Support/Signals.h" 31 #include "llvm/Support/Signals.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 ClFlags::parseFlags(argc, argv); 161 ClFlags::parseFlags(argc, argv);
161 ClFlags &Flags = GlobalContext::Flags; 162 ClFlags &Flags = GlobalContext::Flags;
162 ClFlagsExtra &ExtraFlags = GlobalContext::ExtraFlags; 163 ClFlagsExtra &ExtraFlags = GlobalContext::ExtraFlags;
163 ClFlags::getParsedClFlags(Flags); 164 ClFlags::getParsedClFlags(Flags);
164 ClFlags::getParsedClFlagsExtra(ExtraFlags); 165 ClFlags::getParsedClFlagsExtra(ExtraFlags);
165 166
166 // Override report_fatal_error if we want to exit with 0 status. 167 // Override report_fatal_error if we want to exit with 0 status.
167 if (ExtraFlags.getAlwaysExitSuccess()) 168 if (ExtraFlags.getAlwaysExitSuccess())
168 llvm::install_fatal_error_handler(reportFatalErrorThenExitSuccess, this); 169 llvm::install_fatal_error_handler(reportFatalErrorThenExitSuccess, this);
169 170
171 Ice::LinuxMallocProfiling MallocProfile(Flags.getNumTranslationThreads());
John 2016/03/15 15:19:06 you don't need MallocProfile for anything but RAII
sehr 2016/03/17 16:47:14 Done.
172
170 std::error_code EC; 173 std::error_code EC;
171 std::unique_ptr<Ostream> Ls = makeStream(ExtraFlags.getLogFilename(), EC); 174 std::unique_ptr<Ostream> Ls = makeStream(ExtraFlags.getLogFilename(), EC);
172 if (EC) { 175 if (EC) {
173 llvm::report_fatal_error("Unable to open log file"); 176 llvm::report_fatal_error("Unable to open log file");
174 } 177 }
175 Ls->SetUnbuffered(); 178 Ls->SetUnbuffered();
176 std::unique_ptr<Ostream> Os; 179 std::unique_ptr<Ostream> Os;
177 std::unique_ptr<ELFStreamer> ELFStr; 180 std::unique_ptr<ELFStreamer> ELFStr;
178 switch (Flags.getOutFileType()) { 181 switch (Flags.getOutFileType()) {
179 case FT_Elf: { 182 case FT_Elf: {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 CompileThread.join(); 239 CompileThread.join();
237 } else { 240 } else {
238 getCompiler().run(ExtraFlags, *Ctx.get(), std::move(InputStream)); 241 getCompiler().run(ExtraFlags, *Ctx.get(), std::move(InputStream));
239 } 242 }
240 transferErrorCode( 243 transferErrorCode(
241 getReturnValue(static_cast<ErrorCodes>(Ctx->getErrorStatus()->value()))); 244 getReturnValue(static_cast<ErrorCodes>(Ctx->getErrorStatus()->value())));
242 Ctx->dumpConstantLookupCounts(); 245 Ctx->dumpConstantLookupCounts();
243 } 246 }
244 247
245 } // end of namespace Ice 248 } // end of namespace Ice
OLDNEW
« no previous file with comments | « Makefile.standalone ('k') | src/LinuxMallocProfiling.h » ('j') | src/LinuxMallocProfiling.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698