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

Side by Side Diff: webrtc/logging/rtc_event_log/rtc_event_log.cc

Issue 2996933003: Add logging of host lookups made by TurnPort to the RtcEventLog. (Closed)
Patch Set: Add unittest of rtc_event_log changes Created 3 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void LogAudioNetworkAdaptation( 87 void LogAudioNetworkAdaptation(
88 const AudioEncoderRuntimeConfig& config) override; 88 const AudioEncoderRuntimeConfig& config) override;
89 void LogProbeClusterCreated(int id, 89 void LogProbeClusterCreated(int id,
90 int bitrate_bps, 90 int bitrate_bps,
91 int min_probes, 91 int min_probes,
92 int min_bytes) override; 92 int min_bytes) override;
93 void LogProbeResultSuccess(int id, int bitrate_bps) override; 93 void LogProbeResultSuccess(int id, int bitrate_bps) override;
94 void LogProbeResultFailure(int id, 94 void LogProbeResultFailure(int id,
95 ProbeFailureReason failure_reason) override; 95 ProbeFailureReason failure_reason) override;
96 96
97 void LogHostLookupResult(const std::string& hostname,
98 int error,
99 const std::string& result,
100 int64_t elapsed_time_in_microseconds) override;
101
97 private: 102 private:
98 // Private constructor to ensure that creation is done by RtcEventLog::Create. 103 // Private constructor to ensure that creation is done by RtcEventLog::Create.
99 RtcEventLogImpl(); 104 RtcEventLogImpl();
100 105
101 void StoreEvent(std::unique_ptr<rtclog::Event> event); 106 void StoreEvent(std::unique_ptr<rtclog::Event> event);
102 void LogProbeResult(int id, 107 void LogProbeResult(int id,
103 rtclog::BweProbeResult::ResultType result, 108 rtclog::BweProbeResult::ResultType result,
104 int bitrate_bps); 109 int bitrate_bps);
105 110
106 static volatile int log_count_; 111 static volatile int log_count_;
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 event->set_type(rtclog::Event::BWE_PROBE_RESULT_EVENT); 563 event->set_type(rtclog::Event::BWE_PROBE_RESULT_EVENT);
559 564
560 auto probe_result = event->mutable_probe_result(); 565 auto probe_result = event->mutable_probe_result();
561 probe_result->set_id(id); 566 probe_result->set_id(id);
562 probe_result->set_result(result); 567 probe_result->set_result(result);
563 if (result == rtclog::BweProbeResult::SUCCESS) 568 if (result == rtclog::BweProbeResult::SUCCESS)
564 probe_result->set_bitrate_bps(bitrate_bps); 569 probe_result->set_bitrate_bps(bitrate_bps);
565 StoreEvent(std::move(event)); 570 StoreEvent(std::move(event));
566 } 571 }
567 572
573 void RtcEventLogImpl::LogHostLookupResult(
574 const std::string& hostname,
575 int error,
576 const std::string& lookup_result,
577 int64_t elapsed_time_in_microseconds) {
578 std::unique_ptr<rtclog::Event> event(new rtclog::Event());
579 event->set_timestamp_us(rtc::TimeMicros());
580 event->set_type(rtclog::Event::HOST_LOOKUP_EVENT);
581 auto result = event->mutable_host_lookup_result();
582 result->set_hostname(hostname);
583 result->set_error(error);
584 result->set_lookup_result(lookup_result);
585 result->set_elapsed_time_in_microseconds(elapsed_time_in_microseconds);
586 StoreEvent(std::move(event));
587 }
588
568 void RtcEventLogImpl::StoreEvent(std::unique_ptr<rtclog::Event> event) { 589 void RtcEventLogImpl::StoreEvent(std::unique_ptr<rtclog::Event> event) {
569 RTC_DCHECK(event.get() != nullptr); 590 RTC_DCHECK(event.get() != nullptr);
570 if (!event_queue_.Insert(&event)) { 591 if (!event_queue_.Insert(&event)) {
571 LOG(LS_ERROR) << "WebRTC event log queue full. Dropping event."; 592 LOG(LS_ERROR) << "WebRTC event log queue full. Dropping event.";
572 } 593 }
573 helper_thread_.SignalNewEvent(); 594 helper_thread_.SignalNewEvent();
574 } 595 }
575 596
576 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name, 597 bool RtcEventLog::ParseRtcEventLog(const std::string& file_name,
577 rtclog::EventStream* result) { 598 rtclog::EventStream* result) {
(...skipping 28 matching lines...) Expand all
606 #else 627 #else
607 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 628 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
608 #endif // ENABLE_RTC_EVENT_LOG 629 #endif // ENABLE_RTC_EVENT_LOG
609 } 630 }
610 631
611 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { 632 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() {
612 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 633 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
613 } 634 }
614 635
615 } // namespace webrtc 636 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698