forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cc: Plumbing for impl thread micro benchmarks
This patch adds plumbing for running micro benchmarks on the impl thread. The concept is as follows: - Create a main thread benchmark via gpu benchmarking extension - On commit complete, if the benchmark provides an impl thread benchmark, it is created and scheduled to be run on the impl thread - Impl thread benchmarks are run after an appropriate callback - Impl thread benchmarks post a done callback (with results) that is run on the main thread - The main thread benchmark gets the callback and posts its own done callback (with aggregated results) - This gets back to the gpu benchmarking extension which sends the response back to the caller R=enne@chromium.org, nduca@chromium.org Review URL: https://codereview.chromium.org/67563002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235585 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
vmpstr@chromium.org
committed
Nov 18, 2013
1 parent
9b4b393
commit 5e5648a
Showing
24 changed files
with
448 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright 2013 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "cc/debug/micro_benchmark_controller_impl.h" | ||
|
||
#include <string> | ||
|
||
#include "base/callback.h" | ||
#include "base/values.h" | ||
#include "cc/trees/layer_tree_host_impl.h" | ||
|
||
namespace cc { | ||
|
||
namespace { | ||
|
||
class IsDonePredicate { | ||
public: | ||
typedef const MicroBenchmarkImpl* argument_type; | ||
typedef bool result_type; | ||
|
||
result_type operator()(argument_type benchmark) const { | ||
return benchmark->IsDone(); | ||
} | ||
}; | ||
|
||
} // namespace | ||
|
||
MicroBenchmarkControllerImpl::MicroBenchmarkControllerImpl( | ||
LayerTreeHostImpl* host) | ||
: host_(host) { | ||
DCHECK(host_); | ||
} | ||
|
||
MicroBenchmarkControllerImpl::~MicroBenchmarkControllerImpl() {} | ||
|
||
void MicroBenchmarkControllerImpl::ScheduleRun( | ||
scoped_ptr<MicroBenchmarkImpl> benchmark) { | ||
benchmarks_.push_back(benchmark.Pass()); | ||
} | ||
|
||
void MicroBenchmarkControllerImpl::DidCompleteCommit() { | ||
for (ScopedPtrVector<MicroBenchmarkImpl>::iterator it = benchmarks_.begin(); | ||
it != benchmarks_.end(); | ||
++it) { | ||
DCHECK(!(*it)->IsDone()); | ||
(*it)->DidCompleteCommit(host_); | ||
} | ||
|
||
CleanUpFinishedBenchmarks(); | ||
} | ||
|
||
void MicroBenchmarkControllerImpl::CleanUpFinishedBenchmarks() { | ||
benchmarks_.erase( | ||
benchmarks_.partition(std::not1(IsDonePredicate())), | ||
benchmarks_.end()); | ||
} | ||
|
||
} // namespace cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2013 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CC_DEBUG_MICRO_BENCHMARK_CONTROLLER_IMPL_H_ | ||
#define CC_DEBUG_MICRO_BENCHMARK_CONTROLLER_IMPL_H_ | ||
|
||
#include <string> | ||
|
||
#include "base/basictypes.h" | ||
#include "cc/base/scoped_ptr_vector.h" | ||
#include "cc/debug/micro_benchmark_impl.h" | ||
|
||
namespace cc { | ||
|
||
class LayerTreeHostImpl; | ||
class CC_EXPORT MicroBenchmarkControllerImpl { | ||
public: | ||
explicit MicroBenchmarkControllerImpl(LayerTreeHostImpl* host); | ||
~MicroBenchmarkControllerImpl(); | ||
|
||
void DidCompleteCommit(); | ||
|
||
void ScheduleRun(scoped_ptr<MicroBenchmarkImpl> benchmark); | ||
|
||
private: | ||
void CleanUpFinishedBenchmarks(); | ||
|
||
LayerTreeHostImpl* host_; | ||
ScopedPtrVector<MicroBenchmarkImpl> benchmarks_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(MicroBenchmarkControllerImpl); | ||
}; | ||
|
||
} // namespace cc | ||
|
||
#endif // CC_DEBUG_MICRO_BENCHMARK_CONTROLLER_IMPL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.