diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-11-18 14:58:34 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-11-18 14:58:34 +0000 |
commit | d2e985fd323c167e20f77b045a1d99ad166e65db (patch) | |
tree | 6a111e552c75afc66228e3d8f19b6731e4013f10 /lib/CompilerDriver/Action.cpp | |
parent | ded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89 (diff) | |
download | FreeBSD-src-d2e985fd323c167e20f77b045a1d99ad166e65db.zip FreeBSD-src-d2e985fd323c167e20f77b045a1d99ad166e65db.tar.gz |
Update LLVM to r89205.
Diffstat (limited to 'lib/CompilerDriver/Action.cpp')
-rw-r--r-- | lib/CompilerDriver/Action.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/CompilerDriver/Action.cpp b/lib/CompilerDriver/Action.cpp index 5fd63ee..7bcd30a 100644 --- a/lib/CompilerDriver/Action.cpp +++ b/lib/CompilerDriver/Action.cpp @@ -13,9 +13,13 @@ #include "llvm/CompilerDriver/Action.h" #include "llvm/CompilerDriver/BuiltinOptions.h" + #include "llvm/Support/raw_ostream.h" #include "llvm/System/Program.h" +#include "llvm/System/TimeValue.h" + #include <stdexcept> +#include <string> using namespace llvm; using namespace llvmc; @@ -60,14 +64,31 @@ namespace { } } +namespace llvmc { + void AppendToGlobalTimeLog(const std::string& cmd, double time); +} + int llvmc::Action::Execute() const { if (DryRun || VerboseMode) { errs() << Command_ << " "; std::for_each(Args_.begin(), Args_.end(), print_string); errs() << '\n'; } - if (DryRun) - return 0; - else - return ExecuteProgram(Command_, Args_); + if (!DryRun) { + if (Time) { + sys::TimeValue now = sys::TimeValue::now(); + int ret = ExecuteProgram(Command_, Args_); + sys::TimeValue now2 = sys::TimeValue::now(); + now2 -= now; + double elapsed = now2.seconds() + now2.microseconds() / 1000000.0; + AppendToGlobalTimeLog(Command_, elapsed); + + return ret; + } + else { + return ExecuteProgram(Command_, Args_); + } + } + + return 0; } |