OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This tool is used to benchmark the render model used by the compositor | 5 // This tool is used to benchmark the render model used by the compositor |
6 | 6 |
7 // Most of this file is derived from the source of the tile_render_bench tool, | 7 // Most of this file is derived from the source of the tile_render_bench tool, |
8 // and has been changed to support running a sequence of independent | 8 // and has been changed to support running a sequence of independent |
9 // simulations for our different render models and test cases. | 9 // simulations for our different render models and test cases. |
10 | 10 |
11 #include <stdio.h> | 11 #include <stdio.h> |
12 #include <sys/dir.h> | 12 #include <sys/dir.h> |
13 #include <sys/file.h> | 13 #include <sys/file.h> |
14 #include <sys/stat.h> | 14 #include <sys/stat.h> |
15 #include <sys/types.h> | 15 #include <sys/types.h> |
16 #include <X11/keysym.h> | 16 #include <X11/keysym.h> |
17 #include <X11/Xlib.h> | 17 #include <X11/Xlib.h> |
18 #include <X11/Xutil.h> | 18 #include <X11/Xutil.h> |
19 | 19 |
20 #include <queue> | 20 #include <queue> |
21 #include <string> | 21 #include <string> |
22 #include <vector> | 22 #include <vector> |
23 | 23 |
24 #include "base/at_exit.h" | 24 #include "base/at_exit.h" |
25 #include "base/basictypes.h" | 25 #include "base/basictypes.h" |
26 #include "base/bind.h" | 26 #include "base/bind.h" |
27 #include "base/command_line.h" | 27 #include "base/command_line.h" |
28 #include "base/file_util.h" | 28 #include "base/file_util.h" |
| 29 #include "base/files/file_enumerator.h" |
29 #include "base/files/file_path.h" | 30 #include "base/files/file_path.h" |
30 #include "base/memory/scoped_ptr.h" | 31 #include "base/memory/scoped_ptr.h" |
31 #include "base/message_loop.h" | 32 #include "base/message_loop.h" |
32 #include "base/time.h" | 33 #include "base/time.h" |
33 | 34 |
34 #include "gpu/tools/compositor_model_bench/render_model_utils.h" | 35 #include "gpu/tools/compositor_model_bench/render_model_utils.h" |
35 #include "gpu/tools/compositor_model_bench/render_models.h" | 36 #include "gpu/tools/compositor_model_bench/render_models.h" |
36 #include "gpu/tools/compositor_model_bench/render_tree.h" | 37 #include "gpu/tools/compositor_model_bench/render_tree.h" |
37 | 38 |
38 | 39 |
39 using base::TimeTicks; | 40 using base::TimeTicks; |
40 using file_util::CloseFile; | 41 using file_util::CloseFile; |
41 using file_util::DirectoryExists; | 42 using file_util::DirectoryExists; |
42 using file_util::FileEnumerator; | |
43 using file_util::OpenFile; | 43 using file_util::OpenFile; |
44 using file_util::PathExists; | 44 using file_util::PathExists; |
45 using std::queue; | 45 using std::queue; |
46 using std::string; | 46 using std::string; |
47 | 47 |
48 struct SimulationSpecification { | 48 struct SimulationSpecification { |
49 string simulation_name; | 49 string simulation_name; |
50 base::FilePath input_path; | 50 base::FilePath input_path; |
51 RenderModel model_under_test; | 51 RenderModel model_under_test; |
52 TimeTicks simulation_start_time; | 52 TimeTicks simulation_start_time; |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 Simulator sim(seconds_per_test, cl->GetSwitchValuePath("out")); | 382 Simulator sim(seconds_per_test, cl->GetSwitchValuePath("out")); |
383 base::FilePath inPath = cl->GetSwitchValuePath("in"); | 383 base::FilePath inPath = cl->GetSwitchValuePath("in"); |
384 | 384 |
385 if (!PathExists(inPath)) { | 385 if (!PathExists(inPath)) { |
386 LOG(FATAL) << "Path does not exist: " << inPath.LossyDisplayName(); | 386 LOG(FATAL) << "Path does not exist: " << inPath.LossyDisplayName(); |
387 return -1; | 387 return -1; |
388 } | 388 } |
389 | 389 |
390 if (DirectoryExists(inPath)) { | 390 if (DirectoryExists(inPath)) { |
391 LOG(INFO) << "(input path is a directory)"; | 391 LOG(INFO) << "(input path is a directory)"; |
392 FileEnumerator dirItr(inPath, true, FileEnumerator::FILES); | 392 base::FileEnumerator dirItr(inPath, true, base::FileEnumerator::FILES); |
393 for (base::FilePath f = dirItr.Next(); !f.empty(); f = dirItr.Next()) { | 393 for (base::FilePath f = dirItr.Next(); !f.empty(); f = dirItr.Next()) { |
394 sim.QueueTest(f); | 394 sim.QueueTest(f); |
395 } | 395 } |
396 } else { | 396 } else { |
397 LOG(INFO) << "(input path is a file)"; | 397 LOG(INFO) << "(input path is a file)"; |
398 sim.QueueTest(inPath); | 398 sim.QueueTest(inPath); |
399 } | 399 } |
400 | 400 |
401 sim.Run(); | 401 sim.Run(); |
402 | 402 |
403 return 0; | 403 return 0; |
404 } | 404 } |
OLD | NEW |