Add event scope to all TRACE_EVENT_INSTANTs
These are required by the Perfetto API and the missing argument prevents the use of Perfetto. Bug: webrtc:15917 Change-Id: Ie40c0344dc9d8cd40f7c751b133d150b975a33c7 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347702 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Evan Shrubsole <eshr@google.com> Cr-Commit-Position: refs/heads/main@{#42147}
This commit is contained in:
parent
00566ec1d0
commit
5bfcc873d9
@ -178,8 +178,11 @@ void ScreenCapturerMac::Start(Callback* callback) {
|
||||
RTC_DCHECK(thread_checker_.IsCurrent());
|
||||
RTC_DCHECK(!callback_);
|
||||
RTC_DCHECK(callback);
|
||||
TRACE_EVENT_INSTANT1(
|
||||
"webrtc", "ScreenCapturermac::Start", "target display id ", current_display_);
|
||||
TRACE_EVENT_INSTANT1("webrtc",
|
||||
"ScreenCapturermac::Start",
|
||||
TRACE_EVENT_SCOPE_GLOBAL,
|
||||
"target display id ",
|
||||
current_display_);
|
||||
|
||||
callback_ = callback;
|
||||
// Start and operate CGDisplayStream handler all from capture thread.
|
||||
|
||||
@ -104,7 +104,8 @@ void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
|
||||
absl::optional<uint8_t> qp) {
|
||||
RTC_DCHECK(_receiveCallback) << "Callback must not be null at this point";
|
||||
TRACE_EVENT_INSTANT1("webrtc", "VCMDecodedFrameCallback::Decoded",
|
||||
"timestamp", decodedImage.rtp_timestamp());
|
||||
TRACE_EVENT_SCOPE_GLOBAL, "timestamp",
|
||||
decodedImage.rtp_timestamp());
|
||||
// TODO(holmer): We should improve this so that we can handle multiple
|
||||
// callbacks from one call to Decode().
|
||||
absl::optional<FrameInfo> frame_info;
|
||||
|
||||
@ -1336,8 +1336,8 @@ void RTCStatsCollector::MergeNetworkReport_s() {
|
||||
// Trace WebRTC Stats when getStats is called on Javascript.
|
||||
// This allows access to WebRTC stats from trace logs. To enable them,
|
||||
// select the "webrtc_stats" category when recording traces.
|
||||
TRACE_EVENT_INSTANT1("webrtc_stats", "webrtc_stats", "report",
|
||||
cached_report_->ToJson());
|
||||
TRACE_EVENT_INSTANT1("webrtc_stats", "webrtc_stats", TRACE_EVENT_SCOPE_GLOBAL,
|
||||
"report", cached_report_->ToJson());
|
||||
|
||||
// Deliver report and clear `requests_`.
|
||||
std::vector<RequestInfo> requests;
|
||||
|
||||
@ -206,12 +206,14 @@ class EventLogger final {
|
||||
// Finally start, everything should be set up now.
|
||||
logging_thread_ =
|
||||
PlatformThread::SpawnJoinable([this] { Log(); }, "EventTracingThread");
|
||||
TRACE_EVENT_INSTANT0("webrtc", "EventLogger::Start");
|
||||
TRACE_EVENT_INSTANT0("webrtc", "EventLogger::Start",
|
||||
TRACE_EVENT_SCOPE_GLOBAL);
|
||||
}
|
||||
|
||||
void Stop() {
|
||||
RTC_DCHECK(thread_checker_.IsCurrent());
|
||||
TRACE_EVENT_INSTANT0("webrtc", "EventLogger::Stop");
|
||||
TRACE_EVENT_INSTANT0("webrtc", "EventLogger::Stop",
|
||||
TRACE_EVENT_SCOPE_GLOBAL);
|
||||
// Try to stop. Abort if we're not currently logging.
|
||||
int one = 1;
|
||||
if (g_event_logging_active.compare_exchange_strong(one, 0))
|
||||
|
||||
@ -170,19 +170,25 @@
|
||||
INTERNAL_TRACE_EVENT_ADD_SCOPED(category, name, arg1_name, arg1_val, \
|
||||
arg2_name, arg2_val)
|
||||
|
||||
// Enum reflecting the scope of an INSTANT event. Must fit within
|
||||
// TRACE_EVENT_FLAG_SCOPE_MASK.
|
||||
static constexpr uint8_t TRACE_EVENT_SCOPE_GLOBAL = 0u << 2;
|
||||
static constexpr uint8_t TRACE_EVENT_SCOPE_PROCESS = 1u << 2;
|
||||
static constexpr uint8_t TRACE_EVENT_SCOPE_THREAD = 2u << 2;
|
||||
|
||||
// Records a single event called "name" immediately, with 0, 1 or 2
|
||||
// associated arguments. If the category is not enabled, then this
|
||||
// does nothing.
|
||||
// - category and name strings must have application lifetime (statics or
|
||||
// literals). They may not include " chars.
|
||||
#define TRACE_EVENT_INSTANT0(category, name) \
|
||||
#define TRACE_EVENT_INSTANT0(category, name, scope) \
|
||||
INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category, name, \
|
||||
TRACE_EVENT_FLAG_NONE)
|
||||
#define TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \
|
||||
#define TRACE_EVENT_INSTANT1(category, name, scope, arg1_name, arg1_val) \
|
||||
INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category, name, \
|
||||
TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
|
||||
#define TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, arg2_name, \
|
||||
arg2_val) \
|
||||
#define TRACE_EVENT_INSTANT2(category, name, scope, arg1_name, arg1_val, \
|
||||
arg2_name, arg2_val) \
|
||||
INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, category, name, \
|
||||
TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \
|
||||
arg2_name, arg2_val)
|
||||
@ -709,7 +715,6 @@ class TraceEndOnScopeClose {
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name
|
||||
|
||||
#define TRACE_ID_MANGLE(id) 0
|
||||
@ -719,11 +724,12 @@ class TraceEndOnScopeClose {
|
||||
#define TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val) \
|
||||
RTC_NOOP()
|
||||
|
||||
#define TRACE_EVENT_INSTANT0(category, name) RTC_NOOP()
|
||||
#define TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) RTC_NOOP()
|
||||
#define TRACE_EVENT_INSTANT0(category, name, scope) RTC_NOOP()
|
||||
#define TRACE_EVENT_INSTANT1(category, name, scope, arg1_name, arg1_val) \
|
||||
RTC_NOOP()
|
||||
|
||||
#define TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, arg2_name, \
|
||||
arg2_val) \
|
||||
#define TRACE_EVENT_INSTANT2(category, name, scope, arg1_name, arg1_val, \
|
||||
arg2_name, arg2_val) \
|
||||
RTC_NOOP()
|
||||
|
||||
#define TRACE_EVENT_BEGIN0(category, name) RTC_NOOP()
|
||||
|
||||
@ -469,8 +469,8 @@ void ZeroHertzAdapterMode::UpdateLayerQualityConvergence(
|
||||
bool quality_converged) {
|
||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc"), __func__,
|
||||
"spatial_index", spatial_index, "converged",
|
||||
quality_converged);
|
||||
TRACE_EVENT_SCOPE_GLOBAL, "spatial_index", spatial_index,
|
||||
"converged", quality_converged);
|
||||
if (spatial_index >= layer_trackers_.size())
|
||||
return;
|
||||
if (layer_trackers_[spatial_index].quality_converged.has_value())
|
||||
@ -481,7 +481,8 @@ void ZeroHertzAdapterMode::UpdateLayerStatus(size_t spatial_index,
|
||||
bool enabled) {
|
||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||
TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc"), __func__,
|
||||
"spatial_index", spatial_index, "enabled", enabled);
|
||||
TRACE_EVENT_SCOPE_GLOBAL, "spatial_index", spatial_index,
|
||||
"enabled", enabled);
|
||||
if (spatial_index >= layer_trackers_.size())
|
||||
return;
|
||||
if (enabled) {
|
||||
@ -546,7 +547,8 @@ void ZeroHertzAdapterMode::UpdateVideoSourceRestrictions(
|
||||
absl::optional<double> max_frame_rate) {
|
||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("webrtc"), __func__,
|
||||
"max_frame_rate", max_frame_rate.value_or(-1));
|
||||
TRACE_EVENT_SCOPE_GLOBAL, "max_frame_rate",
|
||||
max_frame_rate.value_or(-1));
|
||||
if (max_frame_rate.value_or(0) > 0) {
|
||||
// Set new, validated (> 0) and restricted frame rate.
|
||||
restricted_frame_delay_ = TimeDelta::Seconds(1) / *max_frame_rate;
|
||||
@ -558,7 +560,7 @@ void ZeroHertzAdapterMode::UpdateVideoSourceRestrictions(
|
||||
|
||||
void ZeroHertzAdapterMode::ProcessKeyFrameRequest() {
|
||||
RTC_DCHECK_RUN_ON(&sequence_checker_);
|
||||
TRACE_EVENT_INSTANT0("webrtc", __func__);
|
||||
TRACE_EVENT_INSTANT0("webrtc", __func__, TRACE_EVENT_SCOPE_GLOBAL);
|
||||
// If we're new and don't have a frame, there's no need to request refresh
|
||||
// frames as this was being triggered for us when zero-hz mode was set up.
|
||||
//
|
||||
|
||||
@ -683,7 +683,8 @@ void VideoSendStreamImpl::Stop() {
|
||||
if (!rtp_video_sender_->IsActive())
|
||||
return;
|
||||
|
||||
TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Stop");
|
||||
TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Stop",
|
||||
TRACE_EVENT_SCOPE_GLOBAL);
|
||||
rtp_video_sender_->SetSending(false);
|
||||
if (IsRunning()) {
|
||||
StopVideoSendStream();
|
||||
|
||||
@ -2129,7 +2129,8 @@ EncodedImageCallback::Result VideoStreamEncoder::OnEncodedImage(
|
||||
const EncodedImage& encoded_image,
|
||||
const CodecSpecificInfo* codec_specific_info) {
|
||||
TRACE_EVENT_INSTANT1("webrtc", "VCMEncodedFrameCallback::Encoded",
|
||||
"timestamp", encoded_image.RtpTimestamp());
|
||||
TRACE_EVENT_SCOPE_GLOBAL, "timestamp",
|
||||
encoded_image.RtpTimestamp());
|
||||
|
||||
const size_t simulcast_index = encoded_image.SimulcastIndex().value_or(0);
|
||||
const VideoCodecType codec_type = codec_specific_info
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user