OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 comparison_available_event_(EventWrapper::Create()), | 70 comparison_available_event_(EventWrapper::Create()), |
71 done_(EventWrapper::Create()) { | 71 done_(EventWrapper::Create()) { |
72 // Create thread pool for CPU-expensive PSNR/SSIM calculations. | 72 // Create thread pool for CPU-expensive PSNR/SSIM calculations. |
73 | 73 |
74 // Try to use about as many threads as cores, but leave kMinCoresLeft alone, | 74 // Try to use about as many threads as cores, but leave kMinCoresLeft alone, |
75 // so that we don't accidentally starve "real" worker threads (codec etc). | 75 // so that we don't accidentally starve "real" worker threads (codec etc). |
76 // Also, don't allocate more than kMaxComparisonThreads, even if there are | 76 // Also, don't allocate more than kMaxComparisonThreads, even if there are |
77 // spare cores. | 77 // spare cores. |
78 | 78 |
79 uint32_t num_cores = CpuInfo::DetectNumberOfCores(); | 79 uint32_t num_cores = CpuInfo::DetectNumberOfCores(); |
80 DCHECK_GE(num_cores, 1u); | 80 RTC_DCHECK_GE(num_cores, 1u); |
81 static const uint32_t kMinCoresLeft = 4; | 81 static const uint32_t kMinCoresLeft = 4; |
82 static const uint32_t kMaxComparisonThreads = 8; | 82 static const uint32_t kMaxComparisonThreads = 8; |
83 | 83 |
84 if (num_cores <= kMinCoresLeft) { | 84 if (num_cores <= kMinCoresLeft) { |
85 num_cores = 1; | 85 num_cores = 1; |
86 } else { | 86 } else { |
87 num_cores -= kMinCoresLeft; | 87 num_cores -= kMinCoresLeft; |
88 num_cores = std::min(num_cores, kMaxComparisonThreads); | 88 num_cores = std::min(num_cores, kMaxComparisonThreads); |
89 } | 89 } |
90 | 90 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 printf("RESULT %s: %s = {%f, %f}%s\n", | 493 printf("RESULT %s: %s = {%f, %f}%s\n", |
494 result_type, | 494 result_type, |
495 test_label_, | 495 test_label_, |
496 stats.Mean(), | 496 stats.Mean(), |
497 stats.StandardDeviation(), | 497 stats.StandardDeviation(), |
498 unit); | 498 unit); |
499 } | 499 } |
500 | 500 |
501 void PrintSamplesToFile(void) { | 501 void PrintSamplesToFile(void) { |
502 FILE* out = fopen(graph_data_output_filename_.c_str(), "w"); | 502 FILE* out = fopen(graph_data_output_filename_.c_str(), "w"); |
503 CHECK(out != nullptr) | 503 RTC_CHECK(out != nullptr) << "Couldn't open file: " |
504 << "Couldn't open file: " << graph_data_output_filename_; | 504 << graph_data_output_filename_; |
505 | 505 |
506 rtc::CritScope crit(&comparison_lock_); | 506 rtc::CritScope crit(&comparison_lock_); |
507 std::sort(samples_.begin(), samples_.end(), | 507 std::sort(samples_.begin(), samples_.end(), |
508 [](const Sample& A, const Sample& B) | 508 [](const Sample& A, const Sample& B) |
509 -> bool { return A.input_time_ms < B.input_time_ms; }); | 509 -> bool { return A.input_time_ms < B.input_time_ms; }); |
510 | 510 |
511 fprintf(out, "%s\n", test_label_); | 511 fprintf(out, "%s\n", test_label_); |
512 fprintf(out, "%" PRIuS "\n", samples_.size()); | 512 fprintf(out, "%" PRIuS "\n", samples_.size()); |
513 fprintf(out, | 513 fprintf(out, |
514 "dropped " | 514 "dropped " |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 50000, | 880 50000, |
881 200000, | 881 200000, |
882 2000000, | 882 2000000, |
883 0.0, | 883 0.0, |
884 0.0, | 884 0.0, |
885 kFullStackTestDurationSecs, | 885 kFullStackTestDurationSecs, |
886 "VP9"}; | 886 "VP9"}; |
887 RunTest(screenshare_params); | 887 RunTest(screenshare_params); |
888 } | 888 } |
889 } // namespace webrtc | 889 } // namespace webrtc |
OLD | NEW |