summaryrefslogtreecommitdiff
path: root/runtime/exec_utils.h
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2024-07-26 17:37:50 +0100
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-08-12 12:32:39 +0000
commitf9af3fa4d54f253bcb42cf571bd309dea60bffb1 (patch)
tree19071b8b06d0238e6076f406de0916f94f1a4d1b /runtime/exec_utils.h
parent8bf0b0a013dc3a6a5d06cfe30aee3f8506042ae4 (diff)
Fix big negative dex2oatWallTimeMillis.
We calculate dex2oatWallTimeMillis by (uptime - starttime). To get a reasonable result, both times need to be from the same clock. However, it's unclear which clock the kernel uses for the latter. proc_pid_stat(5) does not have anything helpful on this matter: (22) starttime %llu The time the process started after system boot. Before Linux 2.6, this value was expressed in jiffies. Since Linux 2.6, the value is expressed in clock ticks (divide by sysconf(_SC_CLK_TCK)). The format for this field was %lu before Linux 2.6. To make sure we use the same clock, we obtain the uptime on process start as the start time. Bug: 315061143 Test: Presubmit Change-Id: I5f344e953a945656474b3f625368c1ccb5aa52d8
Diffstat (limited to 'runtime/exec_utils.h')
-rw-r--r--runtime/exec_utils.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/exec_utils.h b/runtime/exec_utils.h
index ebcc2e4e66..61e9beae32 100644
--- a/runtime/exec_utils.h
+++ b/runtime/exec_utils.h
@@ -118,7 +118,10 @@ class EXPORT ExecUtils {
virtual int64_t GetTicksPerSec() const;
private:
- bool GetStat(pid_t pid, /*out*/ ProcessStat* stat, /*out*/ std::string* error_msg) const;
+ bool GetStat(pid_t pid,
+ int64_t start_time,
+ /*out*/ ProcessStat* stat,
+ /*out*/ std::string* error_msg) const;
};
inline bool Exec(const std::vector<std::string>& arg_vector, /*out*/ std::string* error_msg) {