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.
Add OPTIONAL_TRACE_EVENT{0,1,2} macros. They are equivalent to regular TRACE_EVENTs, but they are disabled by default on the platforms where binary size is a significant factor. R=eseckler@chromium.org BUG=1043616 Change-Id: Ifb4265856826423c5079c5d412fc1234db19e820 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2359132 Commit-Queue: Alexander Timin <altimin@chromium.org> Reviewed-by: François Doray <fdoray@chromium.org> Reviewed-by: Eric Seckler <eseckler@chromium.org> Cr-Commit-Position: refs/heads/master@{#800770}
- Loading branch information
Alexander Timin
authored and
Commit Bot
committed
Aug 21, 2020
1 parent
c37fddb
commit a63ce7f
Showing
3 changed files
with
54 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2020 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 BASE_TRACE_EVENT_OPTIONAL_TRACE_EVENT_H_ | ||
#define BASE_TRACE_EVENT_OPTIONAL_TRACE_EVENT_H_ | ||
|
||
#include "base/trace_event/trace_event.h" | ||
#include "base/tracing_buildflags.h" | ||
#include "build/buildflag.h" | ||
|
||
// These macros are functionally equivalent to TRACE_EVENTX macros, | ||
// but they are disabled if optional_trace_events_enabled gn flag | ||
// defined in tracing.gni is false. | ||
|
||
#if BUILDFLAG(OPTIONAL_TRACE_EVENTS_ENABLED) | ||
|
||
#define OPTIONAL_TRACE_EVENT0(...) TRACE_EVENT0(__VA_ARGS__) | ||
#define OPTIONAL_TRACE_EVENT1(...) TRACE_EVENT1(__VA_ARGS__) | ||
#define OPTIONAL_TRACE_EVENT2(...) TRACE_EVENT2(__VA_ARGS__) | ||
|
||
#else // BUILDFLAG(OPTIONAL_TRACE_EVENTS_ENABLED) | ||
|
||
#define OPTIONAL_TRACE_EVENT0(category, name) | ||
#define OPTIONAL_TRACE_EVENT1(category, name, arg1_name, arg1_val) | ||
#define OPTIONAL_TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, \ | ||
arg2_val) | ||
|
||
#endif // BUILDFLAG(OPTIONAL_TRACE_EVENTS_ENABLED) | ||
|
||
#endif // BASE_TRACE_EVENT_OPTIONAL_TRACE_EVENT_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2020 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. | ||
|
||
import("//build/config/chrome_build.gni") | ||
|
||
declare_args() { | ||
# Enable more trace events. Disabled by default due to binary size impact, | ||
# but highly recommended for local development. | ||
extended_tracing_enabled = false | ||
} | ||
|
||
# Separate block so that we can refer to extended_tracing_enabled's value. | ||
declare_args() { | ||
# Whether OPTIONAL_TRACE_EVENT macros are included in the build or not. | ||
# Disabled by default on Android and ChromeOS due to binary size impact, | ||
# enabled everywhere else. | ||
optional_trace_events_enabled = | ||
(!is_android && !is_chromeos) || extended_tracing_enabled | ||
} |