| 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 <sstream> | 7 #include <sstream> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 #endif // defined(OS_LINUX) || defined(OS_ANDROID) | 300 #endif // defined(OS_LINUX) || defined(OS_ANDROID) |
| 301 | 301 |
| 302 #if defined(OS_CHROMEOS) | 302 #if defined(OS_CHROMEOS) |
| 303 // Chrome OS exposes shmem. | 303 // Chrome OS exposes shmem. |
| 304 EXPECT_GT(info.shmem, 0); | 304 EXPECT_GT(info.shmem, 0); |
| 305 EXPECT_LT(info.shmem, info.total); | 305 EXPECT_LT(info.shmem, info.total); |
| 306 // Chrome unit tests are not run on actual Chrome OS hardware, so gem_objects | 306 // Chrome unit tests are not run on actual Chrome OS hardware, so gem_objects |
| 307 // and gem_size cannot be tested here. | 307 // and gem_size cannot be tested here. |
| 308 #endif | 308 #endif |
| 309 } | 309 } |
| 310 #endif // defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS)) || | 310 #endif // defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS)) || |
| 311 // defined(OS_LINUX) || defined(OS_ANDROID) | 311 // defined(OS_LINUX) || defined(OS_ANDROID) |
| 312 | 312 |
| 313 #if defined(OS_LINUX) || defined(OS_ANDROID) | 313 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| 314 TEST(ProcessMetricsTest, ParseProcStatCPU) { | 314 TEST(ProcessMetricsTest, ParseProcStatCPU) { |
| 315 // /proc/self/stat for a process running "top". | 315 // /proc/self/stat for a process running "top". |
| 316 const char kTopStat[] = "960 (top) S 16230 960 16230 34818 960 " | 316 const char kTopStat[] = "960 (top) S 16230 960 16230 34818 960 " |
| 317 "4202496 471 0 0 0 " | 317 "4202496 471 0 0 0 " |
| 318 "12 16 0 0 " // <- These are the goods. | 318 "12 16 0 0 " // <- These are the goods. |
| 319 "20 0 1 0 121946157 15077376 314 18446744073709551615 4194304 " | 319 "20 0 1 0 121946157 15077376 314 18446744073709551615 4194304 " |
| 320 "4246868 140733983044336 18446744073709551615 140244213071219 " | 320 "4246868 140733983044336 18446744073709551615 140244213071219 " |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 ASSERT_EQ(base::GetNumberOfThreads(current), initial_threads + 1 + i); | 360 ASSERT_EQ(base::GetNumberOfThreads(current), initial_threads + 1 + i); |
| 361 } | 361 } |
| 362 } | 362 } |
| 363 // The Thread destructor will stop them. | 363 // The Thread destructor will stop them. |
| 364 ASSERT_EQ(initial_threads, base::GetNumberOfThreads(current)); | 364 ASSERT_EQ(initial_threads, base::GetNumberOfThreads(current)); |
| 365 } | 365 } |
| 366 #endif // defined(OS_LINUX) | 366 #endif // defined(OS_LINUX) |
| 367 | 367 |
| 368 } // namespace debug | 368 } // namespace debug |
| 369 } // namespace base | 369 } // namespace base |
| OLD | NEW |