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(179LU, meminfo.pswpin); |
290 EXPECT_EQ(meminfo.pswpout, 406); | 290 EXPECT_EQ(406LU, meminfo.pswpout); |
291 EXPECT_EQ(meminfo.pgmajfault, 487192); | 291 EXPECT_EQ(487192LU, meminfo.pgmajfault); |
292 EXPECT_TRUE(ParseProcVmstat(valid_input2, &meminfo)); | 292 EXPECT_TRUE(ParseProcVmstat(valid_input2, &meminfo)); |
293 EXPECT_EQ(meminfo.pswpin, 12); | 293 EXPECT_EQ(12LU, meminfo.pswpin); |
294 EXPECT_EQ(meminfo.pswpout, 901); | 294 EXPECT_EQ(901LU, meminfo.pswpout); |
295 EXPECT_EQ(meminfo.pgmajfault, 2023); | 295 EXPECT_EQ(2023LU, meminfo.pgmajfault); |
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 |