Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: chrome/browser/load_library_perf_test.cc

Issue 151283003: Perf test to measure loading CDM library. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Unload library after each load, allow full library names Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/files/file_path.h"
6 #include "base/path_service.h"
7 #include "base/scoped_native_library.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "base/time/time.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/perf/perf_test.h"
12 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
13
14
15 void MeasureTimeToLoadNativeLibrary(const base::FilePath& library_name) {
16 base::FilePath output_dir;
17 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &output_dir));
18 base::FilePath library_path = output_dir.Append(library_name);
19 std::string error;
20 base::TimeTicks start = base::TimeTicks::HighResNow();
21 base::NativeLibrary native_library =
22 base::LoadNativeLibrary(library_path, &error);
23 double delta = (base::TimeTicks::HighResNow() - start).InMillisecondsF();
24 base::UnloadNativeLibrary(native_library);
25 EXPECT_TRUE(native_library) << "Error loading library:\n" << error;
26 perf_test::PrintResult("time_to_load_library",
27 "",
28 library_name.value(),
29 delta,
30 "ms",
31 true);
32 }
33
34 void MeasureTimeToLoad(const std::string& short_library_name) {
ddorwin 2014/02/10 21:19:06 nit: The name should probably be the same as the o
shadi1 2014/02/10 23:49:08 Done.
35 MeasureTimeToLoadNativeLibrary(base::FilePath::FromUTF16Unsafe(
36 base::GetNativeLibraryName(base::ASCIIToUTF16(short_library_name))));
37 }
38
39 #if defined(ENABLE_PEPPER_CDMS)
40 #if defined(WIDEVINE_CDM_AVAILABLE)
41 TEST(LoadCDMPerfTest, Widevine) {
42 MeasureTimeToLoadNativeLibrary(
43 base::FilePath(FILE_PATH_LITERAL(kWidevineCdmFileName)));
44 }
45
46 TEST(LoadCDMPerfTest, WidevineAdapter) {
47 MeasureTimeToLoadNativeLibrary(
48 base::FilePath(FILE_PATH_LITERAL(kWidevineCdmAdapterFileName)));
49 }
50 #endif // defined(WIDEVINE_CDM_AVAILABLE)
51
52 TEST(LoadCDMPerfTest, ExternalClearKey) {
53 MeasureTimeToLoad("clearkeycdm");
54 }
55
56 TEST(LoadCDMPerfTest, ExternalClearKeyAdapter) {
57 MeasureTimeToLoad("clearkeycdmadapter");
ddorwin 2014/02/10 21:19:06 This string (really the full name) appears in 3 ot
shadi1 2014/02/10 23:49:08 True, a common file can make things cleaner. But p
58 }
59 #endif // defined(ENABLE_PEPPER_CDMS)
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698