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

Side by Side Diff: media/cast/test/cast_benchmarks.cc

Issue 1178423008: Provision to start base::SimpleTestTickClock at initial ticks Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 11 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 | « media/cast/sender/video_sender_unittest.cc ('k') | media/cast/test/end2end_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 program benchmarks the theoretical throughput of the cast library. 5 // This program benchmarks the theoretical throughput of the cast library.
6 // It runs using a fake clock, simulated network and fake codecs. This allows 6 // It runs using a fake clock, simulated network and fake codecs. This allows
7 // tests to run much faster than real time. 7 // tests to run much faster than real time.
8 // To run the program, run: 8 // To run the program, run:
9 // $ ./out/Release/cast_benchmarks | tee benchmarkoutput.asc 9 // $ ./out/Release/cast_benchmarks | tee benchmarkoutput.asc
10 // This may take a while, when it is done, you can view the data with 10 // This may take a while, when it is done, you can view the data with
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 double bitrate; 197 double bitrate;
198 double latency; 198 double latency;
199 double percent_packet_drop; 199 double percent_packet_drop;
200 }; 200 };
201 201
202 class RunOneBenchmark { 202 class RunOneBenchmark {
203 public: 203 public:
204 RunOneBenchmark() 204 RunOneBenchmark()
205 : start_time_(), 205 : start_time_(),
206 testing_clock_(base::TimeTicks() +
207 base::TimeDelta::FromMilliseconds(kStartMillisecond)),
206 task_runner_(new test::FakeSingleThreadTaskRunner(&testing_clock_)), 208 task_runner_(new test::FakeSingleThreadTaskRunner(&testing_clock_)),
207 testing_clock_sender_(new test::SkewedTickClock(&testing_clock_)), 209 testing_clock_sender_(new test::SkewedTickClock(&testing_clock_)),
208 task_runner_sender_( 210 task_runner_sender_(
209 new test::SkewedSingleThreadTaskRunner(task_runner_)), 211 new test::SkewedSingleThreadTaskRunner(task_runner_)),
210 testing_clock_receiver_(new test::SkewedTickClock(&testing_clock_)), 212 testing_clock_receiver_(new test::SkewedTickClock(&testing_clock_)),
211 task_runner_receiver_( 213 task_runner_receiver_(
212 new test::SkewedSingleThreadTaskRunner(task_runner_)), 214 new test::SkewedSingleThreadTaskRunner(task_runner_)),
213 cast_environment_sender_(new CastEnvironment( 215 cast_environment_sender_(new CastEnvironment(
214 scoped_ptr<base::TickClock>(testing_clock_sender_), 216 scoped_ptr<base::TickClock>(testing_clock_sender_),
215 task_runner_sender_, 217 task_runner_sender_,
216 task_runner_sender_, 218 task_runner_sender_,
217 task_runner_sender_)), 219 task_runner_sender_)),
218 cast_environment_receiver_(new CastEnvironment( 220 cast_environment_receiver_(new CastEnvironment(
219 scoped_ptr<base::TickClock>(testing_clock_receiver_), 221 scoped_ptr<base::TickClock>(testing_clock_receiver_),
220 task_runner_receiver_, 222 task_runner_receiver_,
221 task_runner_receiver_, 223 task_runner_receiver_,
222 task_runner_receiver_)), 224 task_runner_receiver_)),
223 receiver_to_sender_(cast_environment_receiver_), 225 receiver_to_sender_(cast_environment_receiver_),
224 sender_to_receiver_(cast_environment_sender_), 226 sender_to_receiver_(cast_environment_sender_),
225 video_bytes_encoded_(0), 227 video_bytes_encoded_(0),
226 audio_bytes_encoded_(0), 228 audio_bytes_encoded_(0),
227 frames_sent_(0) { 229 frames_sent_(0) {}
228 testing_clock_.Advance(
229 base::TimeDelta::FromMilliseconds(kStartMillisecond));
230 }
231 230
232 void Configure(Codec video_codec, 231 void Configure(Codec video_codec,
233 Codec audio_codec) { 232 Codec audio_codec) {
234 audio_sender_config_ = GetDefaultAudioSenderConfig(); 233 audio_sender_config_ = GetDefaultAudioSenderConfig();
235 audio_sender_config_.min_playout_delay = 234 audio_sender_config_.min_playout_delay =
236 audio_sender_config_.max_playout_delay = 235 audio_sender_config_.max_playout_delay =
237 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs); 236 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs);
238 audio_sender_config_.codec = audio_codec; 237 audio_sender_config_.codec = audio_codec;
239 238
240 audio_receiver_config_ = GetDefaultAudioReceiverConfig(); 239 audio_receiver_config_ = GetDefaultAudioReceiverConfig();
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 media::cast::CastBenchmark benchmark; 716 media::cast::CastBenchmark benchmark;
718 if (getenv("PROFILE_FILE")) { 717 if (getenv("PROFILE_FILE")) {
719 std::string profile_file(getenv("PROFILE_FILE")); 718 std::string profile_file(getenv("PROFILE_FILE"));
720 base::debug::StartProfiling(profile_file); 719 base::debug::StartProfiling(profile_file);
721 benchmark.Run(); 720 benchmark.Run();
722 base::debug::StopProfiling(); 721 base::debug::StopProfiling();
723 } else { 722 } else {
724 benchmark.Run(); 723 benchmark.Run();
725 } 724 }
726 } 725 }
OLDNEW
« no previous file with comments | « media/cast/sender/video_sender_unittest.cc ('k') | media/cast/test/end2end_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698