summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--media/base/media_win.cc30
1 files changed, 29 insertions, 1 deletions
diff --git a/media/base/media_win.cc b/media/base/media_win.cc
index 31bfe43..975a301 100644
--- a/media/base/media_win.cc
+++ b/media/base/media_win.cc
@@ -10,6 +10,23 @@
#include "base/logging.h"
#include "base/path_service.h"
+// Enable timing code by turning on TESTING macro.
+//#define TESTING 1
+
+#ifdef TESTING
+#include "base/string_util.h"
+#include "base/time.h"
+
+namespace {
+// Fetch current time as milliseconds.
+// Return as double for high duration and precision.
+// TODO(fbarchard): integrate into base/time.h
+static inline double GetTime() {
+ return base::TimeTicks::HighResNow().ToInternalValue() * (1.0 / 1000.0);
+}
+}
+#endif
+
namespace media {
namespace {
@@ -49,9 +66,20 @@ bool InitializeMediaLibrary(const FilePath& base_path) {
HMODULE libs[arraysize(path_keys)] = {NULL};
for (size_t i = 0; i < arraysize(path_keys); ++i) {
FilePath path = base_path.Append(GetDLLName(path_keys[i]));
- libs[i] = LoadLibrary(path.value().c_str());
+#ifdef TESTING
+ double dll_loadtime_start = GetTime();
+#endif
+ const wchar_t* cpath = path.value().c_str();
+ libs[i] = LoadLibrary(cpath);
if (!libs[i])
break;
+#ifdef TESTING
+ double dll_loadtime_end = GetTime();
+ std::wstring outputbuf = StringPrintf(L"DLL loadtime %5.2f ms, %ls\n",
+ dll_loadtime_end - dll_loadtime_start,
+ cpath);
+ OutputDebugStringW(outputbuf.c_str());
+#endif
}
// Check that we loaded all libraries successfully. We only need to check the