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 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 class Simulator; | 54 class Simulator; |
55 void _process_events(Simulator* sim); | 55 void _process_events(Simulator* sim); |
56 void _update_loop(Simulator* sim); | 56 void _update_loop(Simulator* sim); |
57 | 57 |
58 class Simulator { | 58 class Simulator { |
59 public: | 59 public: |
60 Simulator(int seconds_per_test, const base::FilePath& output_path) | 60 Simulator(int seconds_per_test, const base::FilePath& output_path) |
61 : current_sim_(NULL), | 61 : current_sim_(NULL), |
62 output_path_(output_path), | 62 output_path_(output_path), |
63 seconds_per_test_(seconds_per_test), | 63 seconds_per_test_(seconds_per_test), |
64 weak_factory_(this), | |
65 display_(NULL), | 64 display_(NULL), |
66 window_(0), | 65 window_(0), |
67 gl_context_(NULL), | 66 gl_context_(NULL), |
68 window_width_(WINDOW_WIDTH), | 67 window_width_(WINDOW_WIDTH), |
69 window_height_(WINDOW_HEIGHT) { | 68 window_height_(WINDOW_HEIGHT), |
| 69 weak_factory_(this) { |
70 } | 70 } |
71 | 71 |
72 ~Simulator() { | 72 ~Simulator() { |
73 // Cleanup GL. | 73 // Cleanup GL. |
74 glXMakeCurrent(display_, 0, NULL); | 74 glXMakeCurrent(display_, 0, NULL); |
75 glXDestroyContext(display_, gl_context_); | 75 glXDestroyContext(display_, gl_context_); |
76 | 76 |
77 // Destroy window and display. | 77 // Destroy window and display. |
78 XDestroyWindow(display_, window_); | 78 XDestroyWindow(display_, window_); |
79 XCloseDisplay(display_); | 79 XCloseDisplay(display_); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 } | 337 } |
338 | 338 |
339 // Simulation task list for this execution | 339 // Simulation task list for this execution |
340 RenderModelSimulator* current_sim_; | 340 RenderModelSimulator* current_sim_; |
341 queue<SimulationSpecification> sims_remaining_; | 341 queue<SimulationSpecification> sims_remaining_; |
342 queue<SimulationSpecification> sims_completed_; | 342 queue<SimulationSpecification> sims_completed_; |
343 base::FilePath output_path_; | 343 base::FilePath output_path_; |
344 // Amount of time to run each simulation | 344 // Amount of time to run each simulation |
345 int seconds_per_test_; | 345 int seconds_per_test_; |
346 // GUI data | 346 // GUI data |
347 base::WeakPtrFactory<Simulator> weak_factory_; | |
348 Display* display_; | 347 Display* display_; |
349 Window window_; | 348 Window window_; |
350 GLXContext gl_context_; | 349 GLXContext gl_context_; |
351 int window_width_; | 350 int window_width_; |
352 int window_height_; | 351 int window_height_; |
| 352 base::WeakPtrFactory<Simulator> weak_factory_; |
353 }; | 353 }; |
354 | 354 |
355 int main(int argc, char* argv[]) { | 355 int main(int argc, char* argv[]) { |
356 CommandLine::Init(argc, argv); | 356 CommandLine::Init(argc, argv); |
357 const CommandLine* cl = CommandLine::ForCurrentProcess(); | 357 const CommandLine* cl = CommandLine::ForCurrentProcess(); |
358 | 358 |
359 if (argc != 3 && argc != 4) { | 359 if (argc != 3 && argc != 4) { |
360 LOG(INFO) << "Usage: \n" << | 360 LOG(INFO) << "Usage: \n" << |
361 cl->GetProgram().BaseName().LossyDisplayName() << | 361 cl->GetProgram().BaseName().LossyDisplayName() << |
362 "--in=[input path] --out=[output path] (duration=[seconds])\n" | 362 "--in=[input path] --out=[output path] (duration=[seconds])\n" |
(...skipping 29 matching lines...) Expand all Loading... |
392 } | 392 } |
393 } else { | 393 } else { |
394 LOG(INFO) << "(input path is a file)"; | 394 LOG(INFO) << "(input path is a file)"; |
395 sim.QueueTest(inPath); | 395 sim.QueueTest(inPath); |
396 } | 396 } |
397 | 397 |
398 sim.Run(); | 398 sim.Run(); |
399 | 399 |
400 return 0; | 400 return 0; |
401 } | 401 } |
OLD | NEW |