aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Program.cpp
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2020-04-23 13:04:52 +0700
committerSerge Pavlov <sepavloff@gmail.com>2020-06-17 13:39:59 +0700
commit2e613d2ded2c465bd06bd3cac30ffb4576bf72cc (patch)
tree0d9a6548765470bdd8973de1b86426e9d9b92a5b /llvm/lib/Support/Program.cpp
parente3fd9dc9734c5775dc6824d0a839702e8d43e7f6 (diff)
downloadllvm-2e613d2ded2c465bd06bd3cac30ffb4576bf72cc.zip
llvm-2e613d2ded2c465bd06bd3cac30ffb4576bf72cc.tar.gz
llvm-2e613d2ded2c465bd06bd3cac30ffb4576bf72cc.tar.bz2
[Support] Get process statistics in ExecuteAndWait and Wait
The functions sys::ExcecuteAndWait and sys::Wait now have additional argument of type pointer to structure, which is filled with process execution statistics upon process termination. These are total and user execution times and peak memory consumption. By default this argument is nullptr so existing users of these function must not change behavior. Differential Revision: https://reviews.llvm.org/D78901
Diffstat (limited to 'llvm/lib/Support/Program.cpp')
-rw-r--r--llvm/lib/Support/Program.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Support/Program.cpp b/llvm/lib/Support/Program.cpp
index 0a9363c..d90cb45 100644
--- a/llvm/lib/Support/Program.cpp
+++ b/llvm/lib/Support/Program.cpp
@@ -31,14 +31,16 @@ int sys::ExecuteAndWait(StringRef Program, ArrayRef<StringRef> Args,
Optional<ArrayRef<StringRef>> Env,
ArrayRef<Optional<StringRef>> Redirects,
unsigned SecondsToWait, unsigned MemoryLimit,
- std::string *ErrMsg, bool *ExecutionFailed) {
+ std::string *ErrMsg, bool *ExecutionFailed,
+ Optional<ProcessStatistics> *ProcStat) {
assert(Redirects.empty() || Redirects.size() == 3);
ProcessInfo PI;
if (Execute(PI, Program, Args, Env, Redirects, MemoryLimit, ErrMsg)) {
if (ExecutionFailed)
*ExecutionFailed = false;
- ProcessInfo Result = Wait(
- PI, SecondsToWait, /*WaitUntilTerminates=*/SecondsToWait == 0, ErrMsg);
+ ProcessInfo Result =
+ Wait(PI, SecondsToWait, /*WaitUntilTerminates=*/SecondsToWait == 0,
+ ErrMsg, ProcStat);
return Result.ReturnCode;
}