Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/process/process_metrics.h" | 5 #include "base/process/process_metrics.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 "pgalloc_movable 0\n" | 279 "pgalloc_movable 0\n" |
| 280 "pgfree 308894908\n" | 280 "pgfree 308894908\n" |
| 281 "pgactivate 239320\n" | 281 "pgactivate 239320\n" |
| 282 "pgdeactivate 1\n" | 282 "pgdeactivate 1\n" |
| 283 "pgfault 716044601\n" | 283 "pgfault 716044601\n" |
| 284 "pgmajfault 2023\n" | 284 "pgmajfault 2023\n" |
| 285 "pgrefill_normal 0\n" | 285 "pgrefill_normal 0\n" |
| 286 "pgrefill_high 0\n" | 286 "pgrefill_high 0\n" |
| 287 "pgrefill_movable 0\n"; | 287 "pgrefill_movable 0\n"; |
| 288 EXPECT_TRUE(ParseProcVmstat(valid_input1, &meminfo)); | 288 EXPECT_TRUE(ParseProcVmstat(valid_input1, &meminfo)); |
| 289 EXPECT_EQ(meminfo.pswpin, 179); | 289 EXPECT_EQ(meminfo.pswpin, 179LU); |
|
Lei Zhang
2016/07/29 00:50:13
Flip the arguments to expected / actual, like in e
Tom (Use chromium acct)
2016/07/29 20:28:54
Done.
| |
| 290 EXPECT_EQ(meminfo.pswpout, 406); | 290 EXPECT_EQ(meminfo.pswpout, 406LU); |
| 291 EXPECT_EQ(meminfo.pgmajfault, 487192); | 291 EXPECT_EQ(meminfo.pgmajfault, 487192LU); |
| 292 EXPECT_TRUE(ParseProcVmstat(valid_input2, &meminfo)); | 292 EXPECT_TRUE(ParseProcVmstat(valid_input2, &meminfo)); |
| 293 EXPECT_EQ(meminfo.pswpin, 12); | 293 EXPECT_EQ(meminfo.pswpin, 12LU); |
| 294 EXPECT_EQ(meminfo.pswpout, 901); | 294 EXPECT_EQ(meminfo.pswpout, 901LU); |
| 295 EXPECT_EQ(meminfo.pgmajfault, 2023); | 295 EXPECT_EQ(meminfo.pgmajfault, 2023LU); |
| 296 } | 296 } |
| 297 #endif // defined(OS_LINUX) || defined(OS_ANDROID) | 297 #endif // defined(OS_LINUX) || defined(OS_ANDROID) |
| 298 | 298 |
| 299 #if defined(OS_LINUX) || defined(OS_CHROMEOS) | 299 #if defined(OS_LINUX) || defined(OS_CHROMEOS) |
| 300 | 300 |
| 301 // Test that ProcessMetrics::GetCPUUsage() doesn't return negative values when | 301 // Test that ProcessMetrics::GetCPUUsage() doesn't return negative values when |
| 302 // the number of threads running on the process decreases between two successive | 302 // the number of threads running on the process decreases between two successive |
| 303 // calls to it. | 303 // calls to it. |
| 304 TEST_F(SystemMetricsTest, TestNoNegativeCpuUsage) { | 304 TEST_F(SystemMetricsTest, TestNoNegativeCpuUsage) { |
| 305 ProcessHandle handle = GetCurrentProcessHandle(); | 305 ProcessHandle handle = GetCurrentProcessHandle(); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 498 | 498 |
| 499 std::unique_ptr<ProcessMetrics> metrics( | 499 std::unique_ptr<ProcessMetrics> metrics( |
| 500 ProcessMetrics::CreateProcessMetrics(child.Handle())); | 500 ProcessMetrics::CreateProcessMetrics(child.Handle())); |
| 501 EXPECT_EQ(0, metrics->GetOpenFdCount()); | 501 EXPECT_EQ(0, metrics->GetOpenFdCount()); |
| 502 ASSERT_TRUE(child.Terminate(0, true)); | 502 ASSERT_TRUE(child.Terminate(0, true)); |
| 503 } | 503 } |
| 504 #endif // defined(OS_LINUX) | 504 #endif // defined(OS_LINUX) |
| 505 | 505 |
| 506 } // namespace debug | 506 } // namespace debug |
| 507 } // namespace base | 507 } // namespace base |
| OLD | NEW |