| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifdef WTF | 5 #ifdef WTF |
| 6 | 6 |
| 7 Provides a minimal wrapping of the Blink image decoders. Used to perform | 7 Provides a minimal wrapping of the Blink image decoders. Used to perform |
| 8 a non-threaded, memory-to-memory image decode using micro second accuracy | 8 a non-threaded, memory-to-memory image decode using micro second accuracy |
| 9 clocks to measure image decode time. Optionally applies color correction | 9 clocks to measure image decode time. Optionally applies color correction |
| 10 during image decoding on supported platforms (default off). Usage: | 10 during image decoding on supported platforms (default off). Usage: |
| 11 | 11 |
| 12 % ninja -C /out/Release image_decode_bench && | 12 % ninja -C /out/Release image_decode_bench && |
| 13 ./out/Release/image_decode_bench file [iterations] | 13 ./out/Release/image_decode_bench file [iterations] |
| 14 | 14 |
| 15 FIXME: Consider adding md5 checksum support to WTF. Use it to compute the | 15 FIXME: Consider adding md5 checksum support to WTF. Use it to compute the |
| 16 decoded image frame md5 and output that value. | 16 decoded image frame md5 and output that value. |
| 17 | 17 |
| 18 FIXME: Consider integrating this tool in Chrome telemetry for realz, using | 18 FIXME: Consider integrating this tool in Chrome telemetry for realz, using |
| 19 the image corpii used to assess Blink image decode performance. Refer to | 19 the image corpii used to assess Blink image decode performance. Refer to |
| 20 http://crbug.com/398235#c103 and http://crbug.com/258324#c5 | 20 http://crbug.com/398235#c103 and http://crbug.com/258324#c5 |
| 21 | 21 |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 #include "config.h" | 24 #include "config.h" |
| 25 | 25 |
| 26 #include "platform/SharedBuffer.h" | 26 #include "platform/SharedBuffer.h" |
| 27 #include "platform/image-decoders/ImageDecoder.h" | 27 #include "platform/image-decoders/ImageDecoder.h" |
| 28 #include "platform/testing/TestingPlatformSupport.h" | |
| 29 #include "public/platform/Platform.h" | 28 #include "public/platform/Platform.h" |
| 30 #include "public/web/WebKit.h" | 29 #include "public/web/WebKit.h" |
| 31 #include "wtf/OwnPtr.h" | 30 #include "wtf/OwnPtr.h" |
| 32 #include "wtf/PassRefPtr.h" | 31 #include "wtf/PassRefPtr.h" |
| 33 | 32 |
| 34 #if defined(_WIN32) | 33 #if defined(_WIN32) |
| 35 #if defined(WIN32_LEAN_AND_MEAN) | 34 #if defined(WIN32_LEAN_AND_MEAN) |
| 36 #error Fix: WIN32_LEAN_AND_MEAN disables timeBeginPeriod/TimeEndPeriod. | 35 #error Fix: WIN32_LEAN_AND_MEAN disables timeBeginPeriod/TimeEndPeriod. |
| 37 #endif | 36 #endif |
| 38 #include <mmsystem.h> | 37 #include <mmsystem.h> |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 if (*end != '\0') { | 353 if (*end != '\0') { |
| 355 fprintf(stderr, "Third argument should be packet size. Default is " | 354 fprintf(stderr, "Third argument should be packet size. Default is " |
| 356 "0, meaning to decode the entire image in one packet. You " | 355 "0, meaning to decode the entire image in one packet. You " |
| 357 "supplied %s\n", argv[3]); | 356 "supplied %s\n", argv[3]); |
| 358 exit(1); | 357 exit(1); |
| 359 } | 358 } |
| 360 } | 359 } |
| 361 | 360 |
| 362 // Create a web platform without V8. | 361 // Create a web platform without V8. |
| 363 | 362 |
| 364 class WebPlatform : public TestingPlatformSupport { | 363 class WebPlatform : public blink::Platform { |
| 365 public: | 364 public: |
| 365 const unsigned char* getTraceCategoryEnabledFlag(const char*) override |
| 366 { |
| 367 return reinterpret_cast<const unsigned char *>("nope-none-nada"); |
| 368 } |
| 369 |
| 370 void cryptographicallyRandomValues(unsigned char*, size_t) override |
| 371 { |
| 372 RELEASE_ASSERT_NOT_REACHED(); |
| 373 } |
| 374 |
| 366 void screenColorProfile(WebVector<char>* profile) override | 375 void screenColorProfile(WebVector<char>* profile) override |
| 367 { | 376 { |
| 368 getScreenColorProfile(profile); // Returns a whacked color profile. | 377 getScreenColorProfile(profile); // Returns a whacked color profile. |
| 369 } | 378 } |
| 370 }; | 379 }; |
| 371 | 380 |
| 372 blink::initializeWithoutV8(new WebPlatform()); | 381 blink::initializeWithoutV8(new WebPlatform()); |
| 373 | 382 |
| 374 // Set image decoding Platform options. | 383 // Set image decoding Platform options. |
| 375 | 384 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 402 exit(3); | 411 exit(3); |
| 403 } | 412 } |
| 404 } | 413 } |
| 405 | 414 |
| 406 // Results to stdout. | 415 // Results to stdout. |
| 407 | 416 |
| 408 double averageTime = totalTime / static_cast<double>(iterations); | 417 double averageTime = totalTime / static_cast<double>(iterations); |
| 409 printf("%f %f\n", totalTime, averageTime); | 418 printf("%f %f\n", totalTime, averageTime); |
| 410 return 0; | 419 return 0; |
| 411 } | 420 } |
| OLD | NEW |