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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // sims_remaining_.push(spec); | 106 // sims_remaining_.push(spec); |
107 } | 107 } |
108 | 108 |
109 void Run() { | 109 void Run() { |
110 if (!sims_remaining_.size()) { | 110 if (!sims_remaining_.size()) { |
111 LOG(WARNING) << "No configuration files loaded."; | 111 LOG(WARNING) << "No configuration files loaded."; |
112 return; | 112 return; |
113 } | 113 } |
114 | 114 |
115 base::AtExitManager at_exit; | 115 base::AtExitManager at_exit; |
116 MessageLoop loop; | 116 base::MessageLoop loop; |
117 if (!InitX11() || !InitGLContext()) { | 117 if (!InitX11() || !InitGLContext()) { |
118 LOG(FATAL) << "Failed to set up GUI."; | 118 LOG(FATAL) << "Failed to set up GUI."; |
119 } | 119 } |
120 | 120 |
121 InitBuffers(); | 121 InitBuffers(); |
122 | 122 |
123 LOG(INFO) << "Running " << sims_remaining_.size() << " simulations."; | 123 LOG(INFO) << "Running " << sims_remaining_.size() << " simulations."; |
124 | 124 |
125 loop.PostTask(FROM_HERE, | 125 loop.PostTask(FROM_HERE, |
126 base::Bind(&Simulator::ProcessEvents, | 126 base::Bind(&Simulator::ProcessEvents, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 glXSwapBuffers(display_, window_); | 260 glXSwapBuffers(display_, window_); |
261 | 261 |
262 XExposeEvent ev = { Expose, 0, 1, display_, window_, | 262 XExposeEvent ev = { Expose, 0, 1, display_, window_, |
263 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 0 }; | 263 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 0 }; |
264 XSendEvent(display_, | 264 XSendEvent(display_, |
265 window_, | 265 window_, |
266 False, | 266 False, |
267 ExposureMask, | 267 ExposureMask, |
268 reinterpret_cast<XEvent*>(&ev)); | 268 reinterpret_cast<XEvent*>(&ev)); |
269 | 269 |
270 MessageLoop::current()->PostTask( | 270 base::MessageLoop::current()->PostTask( |
271 FROM_HERE, | 271 FROM_HERE, |
272 base::Bind(&Simulator::UpdateLoop, weak_factory_.GetWeakPtr())); | 272 base::Bind(&Simulator::UpdateLoop, weak_factory_.GetWeakPtr())); |
273 } | 273 } |
274 | 274 |
275 void DumpOutput() { | 275 void DumpOutput() { |
276 LOG(INFO) << "Successfully ran " << sims_completed_.size() << " tests"; | 276 LOG(INFO) << "Successfully ran " << sims_completed_.size() << " tests"; |
277 | 277 |
278 FILE* f = OpenFile(output_path_, "w"); | 278 FILE* f = OpenFile(output_path_, "w"); |
279 | 279 |
280 if (!f) { | 280 if (!f) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 while (sims_remaining_.size() && !InitializeNextTest()) { | 318 while (sims_remaining_.size() && !InitializeNextTest()) { |
319 sims_remaining_.pop(); | 319 sims_remaining_.pop(); |
320 } | 320 } |
321 if (sims_remaining_.size()) { | 321 if (sims_remaining_.size()) { |
322 sims_remaining_.front().simulation_start_time = TimeTicks::Now(); | 322 sims_remaining_.front().simulation_start_time = TimeTicks::Now(); |
323 } | 323 } |
324 } | 324 } |
325 | 325 |
326 if (!sims_remaining_.size()) { | 326 if (!sims_remaining_.size()) { |
327 DumpOutput(); | 327 DumpOutput(); |
328 MessageLoop::current()->Quit(); | 328 base::MessageLoop::current()->Quit(); |
329 return false; | 329 return false; |
330 } | 330 } |
331 | 331 |
332 return true; | 332 return true; |
333 } | 333 } |
334 | 334 |
335 void Resize(int width, int height) { | 335 void Resize(int width, int height) { |
336 window_width_ = width; | 336 window_width_ = width; |
337 window_height_ = height; | 337 window_height_ = height; |
338 if (current_sim_) | 338 if (current_sim_) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |