OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Standalone benchmarking application based on FFmpeg. This tool is used to | 5 // Standalone benchmarking application based on FFmpeg. This tool is used to |
6 // measure decoding performance between different FFmpeg compile and run-time | 6 // measure decoding performance between different FFmpeg compile and run-time |
7 // options. We also use this tool to measure performance regressions when | 7 // options. We also use this tool to measure performance regressions when |
8 // testing newer builds of FFmpeg from trunk. | 8 // testing newer builds of FFmpeg from trunk. |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 const char kSkip[] = "skip"; | 42 const char kSkip[] = "skip"; |
43 const char kFlush[] = "flush"; | 43 const char kFlush[] = "flush"; |
44 const char kDjb2[] = "djb2"; | 44 const char kDjb2[] = "djb2"; |
45 const char kMd5[] = "md5"; | 45 const char kMd5[] = "md5"; |
46 const char kFrames[] = "frames"; | 46 const char kFrames[] = "frames"; |
47 const char kLoop[] = "loop"; | 47 const char kLoop[] = "loop"; |
48 | 48 |
49 } // namespace switches | 49 } // namespace switches |
50 | 50 |
51 #if defined(OS_WIN) | 51 #if defined(OS_WIN) |
| 52 |
| 53 // Enable to build with exception handler |
| 54 //#define ENABLE_WINDOWS_EXCEPTIONS 1 |
| 55 |
| 56 #ifdef ENABLE_WINDOWS_EXCEPTIONS |
52 // warning: disable warning about exception handler. | 57 // warning: disable warning about exception handler. |
53 #pragma warning(disable:4509) | 58 #pragma warning(disable:4509) |
| 59 #endif |
54 | 60 |
55 // Thread priorities to make benchmark more stable. | 61 // Thread priorities to make benchmark more stable. |
56 | 62 |
57 void EnterTimingSection() { | 63 void EnterTimingSection() { |
58 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); | 64 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); |
59 } | 65 } |
60 | 66 |
61 void LeaveTimingSection() { | 67 void LeaveTimingSection() { |
62 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); | 68 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); |
63 } | 69 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 208 |
203 int skip = 0; | 209 int skip = 0; |
204 if (cmd_line->HasSwitch(switches::kSkip)) { | 210 if (cmd_line->HasSwitch(switches::kSkip)) { |
205 std::string skip_opt(cmd_line->GetSwitchValueASCII(switches::kSkip)); | 211 std::string skip_opt(cmd_line->GetSwitchValueASCII(switches::kSkip)); |
206 if (!StringToInt(skip_opt, &skip)) { | 212 if (!StringToInt(skip_opt, &skip)) { |
207 skip = 0; | 213 skip = 0; |
208 } | 214 } |
209 } | 215 } |
210 | 216 |
211 std::ostream* log_out = &std::cout; | 217 std::ostream* log_out = &std::cout; |
212 #if defined(OS_WIN) | 218 #if defined(ENABLE_WINDOWS_EXCEPTIONS) |
213 // Catch exceptions so this tool can be used in automated testing. | 219 // Catch exceptions so this tool can be used in automated testing. |
214 __try { | 220 __try { |
215 #endif | 221 #endif |
216 | 222 |
217 // Register FFmpeg and attempt to open file. | 223 // Register FFmpeg and attempt to open file. |
218 avcodec_init(); | 224 avcodec_init(); |
219 av_log_set_level(verbose_level); | 225 av_log_set_level(verbose_level); |
220 av_register_all(); | 226 av_register_all(); |
221 av_register_protocol(&kFFmpegFileProtocol); | 227 av_register_protocol(&kFFmpegFileProtocol); |
222 AVFormatContext* format_context = NULL; | 228 AVFormatContext* format_context = NULL; |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 if (hash_djb2) { | 553 if (hash_djb2) { |
548 *log_out << " DJB2 Hash:" << std::setw(11) << hash_value | 554 *log_out << " DJB2 Hash:" << std::setw(11) << hash_value |
549 << " " << in_path << std::endl; | 555 << " " << in_path << std::endl; |
550 } | 556 } |
551 if (hash_md5) { | 557 if (hash_md5) { |
552 MD5Digest digest; // The result of the computation. | 558 MD5Digest digest; // The result of the computation. |
553 MD5Final(&digest, &ctx); | 559 MD5Final(&digest, &ctx); |
554 *log_out << " MD5 Hash: " << MD5DigestToBase16(digest) | 560 *log_out << " MD5 Hash: " << MD5DigestToBase16(digest) |
555 << " " << in_path << std::endl; | 561 << " " << in_path << std::endl; |
556 } | 562 } |
557 #if defined(OS_WIN) | 563 #if defined(ENABLE_WINDOWS_EXCEPTIONS) |
558 } __except(EXCEPTION_EXECUTE_HANDLER) { | 564 } __except(EXCEPTION_EXECUTE_HANDLER) { |
559 *log_out << " Exception:" << std::setw(11) << GetExceptionCode() | 565 *log_out << " Exception:" << std::setw(11) << GetExceptionCode() |
560 << " " << in_path << std::endl; | 566 << " " << in_path << std::endl; |
561 return 1; | 567 return 1; |
562 } | 568 } |
563 #endif | 569 #endif |
564 CommandLine::Reset(); | 570 CommandLine::Reset(); |
565 return 0; | 571 return 0; |
566 } | 572 } |
OLD | NEW |