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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 thread3.StartAndWaitForTesting(); | 370 thread3.StartAndWaitForTesting(); |
371 | 371 |
372 ASSERT_TRUE(thread1.IsRunning()); | 372 ASSERT_TRUE(thread1.IsRunning()); |
373 ASSERT_TRUE(thread2.IsRunning()); | 373 ASSERT_TRUE(thread2.IsRunning()); |
374 ASSERT_TRUE(thread3.IsRunning()); | 374 ASSERT_TRUE(thread3.IsRunning()); |
375 | 375 |
376 std::vector<std::string> vec1; | 376 std::vector<std::string> vec1; |
377 std::vector<std::string> vec2; | 377 std::vector<std::string> vec2; |
378 std::vector<std::string> vec3; | 378 std::vector<std::string> vec3; |
379 | 379 |
380 thread1.task_runner()->PostTask(FROM_HERE, Bind(&BusyWork, &vec1)); | 380 thread1.task_runner()->PostTask(FROM_HERE, BindOnce(&BusyWork, &vec1)); |
381 thread2.task_runner()->PostTask(FROM_HERE, Bind(&BusyWork, &vec2)); | 381 thread2.task_runner()->PostTask(FROM_HERE, BindOnce(&BusyWork, &vec2)); |
382 thread3.task_runner()->PostTask(FROM_HERE, Bind(&BusyWork, &vec3)); | 382 thread3.task_runner()->PostTask(FROM_HERE, BindOnce(&BusyWork, &vec3)); |
383 | 383 |
384 EXPECT_GE(metrics->GetCPUUsage(), 0.0); | 384 EXPECT_GE(metrics->GetCPUUsage(), 0.0); |
385 | 385 |
386 thread1.Stop(); | 386 thread1.Stop(); |
387 EXPECT_GE(metrics->GetCPUUsage(), 0.0); | 387 EXPECT_GE(metrics->GetCPUUsage(), 0.0); |
388 | 388 |
389 thread2.Stop(); | 389 thread2.Stop(); |
390 EXPECT_GE(metrics->GetCPUUsage(), 0.0); | 390 EXPECT_GE(metrics->GetCPUUsage(), 0.0); |
391 | 391 |
392 thread3.Stop(); | 392 thread3.Stop(); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 562 |
563 std::unique_ptr<ProcessMetrics> metrics( | 563 std::unique_ptr<ProcessMetrics> metrics( |
564 ProcessMetrics::CreateProcessMetrics(spawn_child.process.Handle())); | 564 ProcessMetrics::CreateProcessMetrics(spawn_child.process.Handle())); |
565 EXPECT_EQ(0, metrics->GetOpenFdCount()); | 565 EXPECT_EQ(0, metrics->GetOpenFdCount()); |
566 ASSERT_TRUE(spawn_child.process.Terminate(0, true)); | 566 ASSERT_TRUE(spawn_child.process.Terminate(0, true)); |
567 } | 567 } |
568 #endif // defined(OS_LINUX) | 568 #endif // defined(OS_LINUX) |
569 | 569 |
570 } // namespace debug | 570 } // namespace debug |
571 } // namespace base | 571 } // namespace base |
OLD | NEW |