diff options
author | Nicolas Lacasse <nlacasse@google.com> | 2019-03-27 12:40:18 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-03-27 12:41:27 -0700 |
commit | 2d355f0e8fb8f7e72e6448fd4fcc4e79cdb6ba72 (patch) | |
tree | 18803e4d5278c08b1133d3444478e89a21a08752 /test/syscalls | |
parent | 5d94c893ae38f09f5132ab43d48204ab49121960 (diff) |
Add start time to /proc/<pid>/stat.
The start time is the number of clock ticks between the boot time and
application start time.
PiperOrigin-RevId: 240619475
Change-Id: Ic8bd7a73e36627ed563988864b0c551c052492a5
Diffstat (limited to 'test/syscalls')
-rw-r--r-- | test/syscalls/linux/proc.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/syscalls/linux/proc.cc b/test/syscalls/linux/proc.cc index 0da682e7b..64d75d9fb 100644 --- a/test/syscalls/linux/proc.cc +++ b/test/syscalls/linux/proc.cc @@ -880,6 +880,14 @@ TEST_P(ProcPidStatTest, HasBasicFields) { EXPECT_EQ("R", fields[2]); // task state EXPECT_EQ(absl::StrCat(getppid()), fields[3]); + // If the test starts up quickly, then the process start time and the kernel + // boot time will be very close, and the proc starttime field (which is the + // delta of the two times) will be 0. For that unfortunate reason, we can + // only check that starttime >= 0, and not that it is strictly > 0. + uint64_t starttime; + ASSERT_TRUE(absl::SimpleAtoi(fields[21], &starttime)); + EXPECT_GE(starttime, 0); + uint64_t vss; ASSERT_TRUE(absl::SimpleAtoi(fields[22], &vss)); EXPECT_GT(vss, 0); |