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

Side by Side Diff: chrome/browser/extensions/api/cast_streaming/performance_test.cc

Issue 1065113003: Make castv2 performance test work. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | no next file » | 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 #include <map> 5 #include <map>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 event_maps.push_back(std::make_pair(&onbuffer, "timestamp")); 490 event_maps.push_back(std::make_pair(&onbuffer, "timestamp"));
491 event_maps.push_back(std::make_pair(&sink, "time_delta")); 491 event_maps.push_back(std::make_pair(&sink, "time_delta"));
492 event_maps.push_back(std::make_pair(&inserted, "timestamp")); 492 event_maps.push_back(std::make_pair(&inserted, "timestamp"));
493 event_maps.push_back(std::make_pair(&encoded, "rtp_timestamp")); 493 event_maps.push_back(std::make_pair(&encoded, "rtp_timestamp"));
494 event_maps.push_back(std::make_pair(&transmitted, "rtp_timestamp")); 494 event_maps.push_back(std::make_pair(&transmitted, "rtp_timestamp"));
495 event_maps.push_back(std::make_pair(&decoded, "rtp_timestamp")); 495 event_maps.push_back(std::make_pair(&decoded, "rtp_timestamp"));
496 event_maps.push_back(std::make_pair(&done, "render_time")); 496 event_maps.push_back(std::make_pair(&done, "render_time"));
497 497
498 trace_analyzer::TraceEventVector capture_events; 498 trace_analyzer::TraceEventVector capture_events;
499 GetTraceEvents(analyzer, "Capture" , &capture_events); 499 GetTraceEvents(analyzer, "Capture" , &capture_events);
500 EXPECT_GT(capture_events.size(), 0UL);
500 std::vector<std::vector<double> > traced_frames; 501 std::vector<std::vector<double> > traced_frames;
501 for (size_t i = kSkipEvents; i < capture_events.size(); i++) { 502 for (size_t i = kSkipEvents; i < capture_events.size(); i++) {
502 std::vector<double> times; 503 std::vector<double> times;
503 const trace_analyzer::TraceEvent *event = capture_events[i]; 504 const trace_analyzer::TraceEvent *event = capture_events[i];
504 times.push_back(event->timestamp); // begin capture 505 times.push_back(event->timestamp); // begin capture
505 event = event->other_event; 506 event = event->other_event;
506 if (!event) { 507 if (!event) {
507 continue; 508 continue;
508 } 509 }
509 times.push_back(event->timestamp); // end capture (with timestamp) 510 times.push_back(event->timestamp); // end capture (with timestamp)
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 proxy_end_point, 604 proxy_end_point,
604 receiver_end_point, 605 receiver_end_point,
605 media::cast::test::BadNetwork().Pass(), 606 media::cast::test::BadNetwork().Pass(),
606 media::cast::test::BadNetwork().Pass(), 607 media::cast::test::BadNetwork().Pass(),
607 NULL); 608 NULL);
608 } 609 }
609 receiver_end_point = proxy_end_point; 610 receiver_end_point = proxy_end_point;
610 } 611 }
611 612
612 std::string json_events; 613 std::string json_events;
613 ASSERT_TRUE(tracing::BeginTracing("test_fps,mirroring,cast_perf_test")); 614 ASSERT_TRUE(tracing::BeginTracing(
615 "test_fps,mirroring,gpu.capture,cast_perf_test"));
614 const std::string page_url = base::StringPrintf( 616 const std::string page_url = base::StringPrintf(
615 "performance%d.html?port=%d", 617 "performance%d.html?port=%d",
616 getfps(), 618 getfps(),
617 receiver_end_point.port()); 619 receiver_end_point.port());
618 ASSERT_TRUE(RunExtensionSubtest("cast_streaming", page_url)) << message_; 620 ASSERT_TRUE(RunExtensionSubtest("cast_streaming", page_url)) << message_;
619 ASSERT_TRUE(tracing::EndTracing(&json_events)); 621 ASSERT_TRUE(tracing::EndTracing(&json_events));
620 receiver->Stop(); 622 receiver->Stop();
621 623
622 // Stop all threads, removes the need for synchronization when analyzing 624 // Stop all threads, removes the need for synchronization when analyzing
623 // the data. 625 // the data.
624 cast_environment->Shutdown(); 626 cast_environment->Shutdown();
625 scoped_ptr<trace_analyzer::TraceAnalyzer> analyzer; 627 scoped_ptr<trace_analyzer::TraceAnalyzer> analyzer;
626 analyzer.reset(trace_analyzer::TraceAnalyzer::Create(json_events)); 628 analyzer.reset(trace_analyzer::TraceAnalyzer::Create(json_events));
627 analyzer->AssociateAsyncBeginEndEvents(); 629 analyzer->AssociateAsyncBeginEndEvents();
628 630
629 MeanAndError frame_data = AnalyzeTraceDistance( 631 MeanAndError frame_data = AnalyzeTraceDistance(
630 analyzer.get(), 632 analyzer.get(),
631 TRACE_DISABLED_BY_DEFAULT("OnSwapCompositorFrame")); 633 "OnSwapCompositorFrame");
632 634
633 EXPECT_GT(frame_data.num_values, 0UL); 635 EXPECT_GT(frame_data.num_values, 0UL);
634 // Lower is better. 636 // Lower is better.
635 frame_data.Print(test_name, 637 frame_data.Print(test_name,
636 GetSuffixForTestFlags(), 638 GetSuffixForTestFlags(),
637 "time_between_frames", 639 "time_between_frames",
638 "ms"); 640 "ms");
639 641
640 // This prints out the average time between capture events. 642 // This prints out the average time between capture events.
641 // As the capture frame rate is capped at 30fps, this score 643 // As the capture frame rate is capped at 30fps, this score
(...skipping 24 matching lines...) Expand all
666 CastV2PerformanceTest, 668 CastV2PerformanceTest,
667 testing::Values( 669 testing::Values(
668 kUseGpu | k24fps, 670 kUseGpu | k24fps,
669 kUseGpu | k30fps, 671 kUseGpu | k30fps,
670 kUseGpu | k60fps, 672 kUseGpu | k60fps,
671 kUseGpu | k24fps | kDisableVsync, 673 kUseGpu | k24fps | kDisableVsync,
672 kUseGpu | k30fps | kProxyWifi, 674 kUseGpu | k30fps | kProxyWifi,
673 kUseGpu | k30fps | kProxyBad, 675 kUseGpu | k30fps | kProxyBad,
674 kUseGpu | k30fps | kSlowClock, 676 kUseGpu | k30fps | kSlowClock,
675 kUseGpu | k30fps | kFastClock)); 677 kUseGpu | k30fps | kFastClock));
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698