Skip to content

Commit

Permalink
perfetto: mass reformat files
Browse files Browse the repository at this point in the history
Change-Id: Iad7aec73d2a595996265c26fa608b979377b9704
  • Loading branch information
LalitMaganti committed May 29, 2024
1 parent aa96446 commit bdd33a2
Show file tree
Hide file tree
Showing 62 changed files with 589 additions and 487 deletions.
5 changes: 3 additions & 2 deletions gn/proto_library.gni
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,10 @@ template("perfetto_proto_library") {
proto_library_sources = invoker.sources
proto_import_dirs = import_dirs_
exports = []
foreach (i, public_deps_) {
foreach(i, public_deps_) {
# Get the absolute target path
exports += [get_label_info(i, "dir") + ":" + get_label_info(i, "name")]
exports +=
[ get_label_info(i, "dir") + ":" + get_label_info(i, "name") ]
}
}
forward_variables_from(invoker, vars_to_forward)
Expand Down
1 change: 0 additions & 1 deletion gn/standalone/protoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@
import sys
import subprocess


if __name__ == '__main__':
sys.exit(subprocess.call(sys.argv[1:]))
2 changes: 1 addition & 1 deletion include/perfetto/base/build_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_CLANG() 1
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_GCC() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_MSVC() 0
#elif defined(__GNUC__) // Careful: Clang also defines this!
#elif defined(__GNUC__) // Careful: Clang also defines this!
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_CLANG() 0
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_GCC() 1
#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPILER_MSVC() 0
Expand Down
2 changes: 1 addition & 1 deletion include/perfetto/ext/base/unix_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace base {
// Define the ScopedSocketHandle type.

#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
int CloseSocket(SocketHandle); // A wrapper around ::closesocket().
int CloseSocket(SocketHandle); // A wrapper around ::closesocket().
using ScopedSocketHandle =
ScopedResource<SocketHandle, CloseSocket, static_cast<SocketHandle>(-1)>;
#else
Expand Down
3 changes: 2 additions & 1 deletion include/perfetto/public/data_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ static inline bool PerfettoDsRegister(struct PerfettoDs* ds,
PerfettoPbMsgInit(&desc.msg, &writer);

perfetto_protos_DataSourceDescriptor_set_cstr_name(&desc, data_source_name);
perfetto_protos_DataSourceDescriptor_set_will_notify_on_stop(&desc, params.will_notify_on_stop);
perfetto_protos_DataSourceDescriptor_set_will_notify_on_stop(
&desc, params.will_notify_on_stop);

desc_size = PerfettoStreamWriterGetWrittenSize(&writer.writer);
desc_buf = malloc(desc_size);
Expand Down
20 changes: 11 additions & 9 deletions include/perfetto/tracing/internal/track_event_data_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ template <>
struct TraceTimestampTraits<uint64_t> {
static inline TraceTimestamp ConvertTimestampToTraceTimeNs(
const uint64_t& timestamp) {
return {static_cast<uint32_t>(internal::TrackEventInternal::GetClockId()), timestamp};
return {static_cast<uint32_t>(internal::TrackEventInternal::GetClockId()),
timestamp};
}
};

Expand Down Expand Up @@ -108,14 +109,15 @@ static constexpr bool IsValidNormalTrack() {
// Because the user can use arbitrary timestamp types, we can't compare against
// any known base type here. Instead, we check that a track or a trace lambda
// isn't being interpreted as a timestamp.
template <typename T,
typename CanBeConvertedToNsCheck = decltype(
::perfetto::TraceTimestampTraits<typename base::remove_cvref_t<
T>>::ConvertTimestampToTraceTimeNs(std::declval<T>())),
typename NotTrackCheck =
typename std::enable_if<!IsValidNormalTrack<T>()>::type,
typename NotLambdaCheck =
typename std::enable_if<!IsValidTraceLambda<T>()>::type>
template <
typename T,
typename CanBeConvertedToNsCheck =
decltype(::perfetto::TraceTimestampTraits<typename base::remove_cvref_t<
T>>::ConvertTimestampToTraceTimeNs(std::declval<T>())),
typename NotTrackCheck =
typename std::enable_if<!IsValidNormalTrack<T>()>::type,
typename NotLambdaCheck =
typename std::enable_if<!IsValidTraceLambda<T>()>::type>
static constexpr bool IsValidTimestamp() {
return true;
}
Expand Down
4 changes: 3 additions & 1 deletion include/perfetto/tracing/internal/track_event_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@
/* that the scoped event is exactly ONE line and can't escape the */ \
/* scope if used in a single line if statement. */ \
EventFinalizer(...) {} \
~EventFinalizer() { TRACE_EVENT_END(category); } \
~EventFinalizer() { \
TRACE_EVENT_END(category); \
} \
\
EventFinalizer(const EventFinalizer&) = delete; \
inline EventFinalizer& operator=(const EventFinalizer&) = delete; \
Expand Down
4 changes: 2 additions & 2 deletions include/perfetto/tracing/tracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ class PERFETTO_EXPORT_COMPONENT StartupTracingSession {
virtual void AbortBlocking() = 0;
};

PERFETTO_ALWAYS_INLINE inline std::unique_ptr<TracingSession>
Tracing::NewTrace(BackendType backend) {
PERFETTO_ALWAYS_INLINE inline std::unique_ptr<TracingSession> Tracing::NewTrace(
BackendType backend) {
// This code is inlined to allow dead-code elimination for unused consumer
// implementation. The logic behind it is the following:
// Nothing other than the code below references the GetInstance() method
Expand Down
4 changes: 3 additions & 1 deletion include/perfetto/tracing/track_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@

// Deprecated; see perfetto::Category().
#define PERFETTO_CATEGORY(name) \
::perfetto::Category { #name }
::perfetto::Category { \
#name \
}

// Internal helpers for determining if a given category is defined at build or
// runtime.
Expand Down
178 changes: 96 additions & 82 deletions protos/perfetto/config/android/android_input_event_config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,97 +24,111 @@ package perfetto.protos;
//
// Next ID: 5
message AndroidInputEventConfig {
// Trace modes are tracing presets that are included in the system.
enum TraceMode {
// Preset mode for maximal tracing.
// WARNING: This will bypass all privacy measures on debuggable builds, and
// will record all
// input events processed by the system, regardless of the context
// in which they were processed. It should only be used for tracing
// on a local device or for tests. It should NEVER be used for
// field tracing.
TRACE_MODE_TRACE_ALL = 0;
// Use the tracing rules defined in this config to specify what events to
// trace.
TRACE_MODE_USE_RULES = 1;
}

// Trace modes are tracing presets that are included in the system.
enum TraceMode {
// Preset mode for maximal tracing.
// WARNING: This will bypass all privacy measures on debuggable builds, and will record all
// input events processed by the system, regardless of the context in which they
// were processed. It should only be used for tracing on a local device or for
// tests. It should NEVER be used for field tracing.
TRACE_MODE_TRACE_ALL = 0;
// Use the tracing rules defined in this config to specify what events to trace.
TRACE_MODE_USE_RULES = 1;
}
// The tracing mode to use. If unspecified, it will default to
// TRACE_MODE_USE_RULES.
optional TraceMode mode = 1;

// The tracing mode to use. If unspecified, it will default to TRACE_MODE_USE_RULES.
optional TraceMode mode = 1;
// The level of tracing that should be applied to an event.
enum TraceLevel {
// Do not trace the input event.
TRACE_LEVEL_NONE = 0;
// Trace the event as a redacted event, where certain sensitive fields are
// omitted from the trace, including the coordinates of pointer events and
// the key/scan codes of key events.
TRACE_LEVEL_REDACTED = 1;
// Trace the complete event.
TRACE_LEVEL_COMPLETE = 2;
}

// The level of tracing that should be applied to an event.
enum TraceLevel {
// Do not trace the input event.
TRACE_LEVEL_NONE = 0;
// Trace the event as a redacted event, where certain sensitive fields are omitted from
// the trace, including the coordinates of pointer events and the key/scan codes of key
// events.
TRACE_LEVEL_REDACTED = 1;
// Trace the complete event.
TRACE_LEVEL_COMPLETE = 2;
}
// A rule that specifies the TraceLevel for an event based on matching
// conditions. All matchers in the rule are optional. To trigger this rule, an
// event must match all of its specified matchers (i.e. the matchers function
// like a series of conditions connected by a logical 'AND' operator). A rule
// with no specified matchers will match all events. Next ID: 6
message TraceRule {
// The trace level to be used for events that trigger this rule.
// If unspecified, TRACE_LEVEL_NONE will be used by default.
optional TraceLevel trace_level = 1;

// A rule that specifies the TraceLevel for an event based on matching conditions.
// All matchers in the rule are optional. To trigger this rule, an event must match all
// of its specified matchers (i.e. the matchers function like a series of conditions connected
// by a logical 'AND' operator). A rule with no specified matchers will match all events.
// Next ID: 6
message TraceRule {
// The trace level to be used for events that trigger this rule.
// If unspecified, TRACE_LEVEL_NONE will be used by default.
optional TraceLevel trace_level = 1;
// --- Optional Matchers ---

// --- Optional Matchers ---
// Package matchers
//
// Respectively matches if all or any of the target apps for this event are
// contained in the specified list of package names.
//
// Intended usage:
// - Use match_all_packages to selectively allow tracing for the listed
// packages.
// - Use match_any_packages to selectively deny tracing for certain
// packages.
//
// WARNING: Great care must be taken when designing rules for field tracing!
// This is because each event is almost always sent to more than
// one app.
// For example, when allowing tracing for a package that has a
// spy window
// over the display (e.g. SystemUI) using match_any_packages,
// essentially all input will be recorded on that display. This is
// because the events will be sent to the spy as well as the
// foreground app, and regardless of what the foreground app is,
// the event will end up being traced.
// Alternatively, when attempting to block tracing for specific
// packages using
// match_all_packages, no events will likely be blocked. This is
// because the event will also be sent to other apps (such as, but
// not limited to, ones with spy windows), so the matcher will not
// match unless all other targets are also listed under the
// match_all_packages list.
repeated string match_all_packages = 2;
repeated string match_any_packages = 3;

// Package matchers
//
// Respectively matches if all or any of the target apps for this event are contained in
// the specified list of package names.
//
// Intended usage:
// - Use match_all_packages to selectively allow tracing for the listed packages.
// - Use match_any_packages to selectively deny tracing for certain packages.
//
// WARNING: Great care must be taken when designing rules for field tracing!
// This is because each event is almost always sent to more than one app.
// For example, when allowing tracing for a package that has a spy window
// over the display (e.g. SystemUI) using match_any_packages, essentially all
// input will be recorded on that display. This is because the events will be sent
// to the spy as well as the foreground app, and regardless of what the foreground
// app is, the event will end up being traced.
// Alternatively, when attempting to block tracing for specific packages using
// match_all_packages, no events will likely be blocked. This is because the event
// will also be sent to other apps (such as, but not limited to, ones with spy
// windows), so the matcher will not match unless all other targets are also
// listed under the match_all_packages list.
repeated string match_all_packages = 2;
repeated string match_any_packages = 3;
// Matches if the event is secure, which means that at least one of the
// targets of this event is using the window flag FLAG_SECURE.
optional bool match_secure = 4;

// Matches if the event is secure, which means that at least one of the targets of
// this event is using the window flag FLAG_SECURE.
optional bool match_secure = 4;
// Matches if there was an active IME connection while this event was being
// processed.
optional bool match_ime_connection_active = 5;
}

// Matches if there was an active IME connection while this event was being processed.
optional bool match_ime_connection_active = 5;
}
// The list of rules to use to determine the trace level of events.
// Each event will be traced using the TraceLevel of the first rule that it
// triggers from this list. The rules are evaluated in the order in which they
// are specified. If an event does not match any of the rules,
// TRACE_LEVEL_NONE will be used by default.
repeated TraceRule rules = 2;

// The list of rules to use to determine the trace level of events.
// Each event will be traced using the TraceLevel of the first rule that it triggers
// from this list. The rules are evaluated in the order in which they are specified.
// If an event does not match any of the rules, TRACE_LEVEL_NONE will be used by default.
repeated TraceRule rules = 2;
// --- Control flags ---

// --- Control flags ---
// Trace input events processed by the system as they are being dispatched
// to application windows. All trace rules will apply.
// - If this flag is used without enabling trace_dispatcher_window_dispatch,
// it will
// trace InputDispatcher's inbound events (which does not include events
// synthesized within InputDispatcher) that match the rules.
// - If used with trace_dispatcher_window_dispatch, all inbound and outbound
// events
// matching the rules, including all events synthesized within
// InputDispatcher, will be traced.
optional bool trace_dispatcher_input_events = 3;

// Trace input events processed by the system as they are being dispatched
// to application windows. All trace rules will apply.
// - If this flag is used without enabling trace_dispatcher_window_dispatch, it will
// trace InputDispatcher's inbound events (which does not include events synthesized
// within InputDispatcher) that match the rules.
// - If used with trace_dispatcher_window_dispatch, all inbound and outbound events
// matching the rules, including all events synthesized within InputDispatcher,
// will be traced.
optional bool trace_dispatcher_input_events = 3;

// Trace details about which windows the system is sending each input event to.
// All trace rules will apply.
optional bool trace_dispatcher_window_dispatch = 4;
// Trace details about which windows the system is sending each input event
// to. All trace rules will apply.
optional bool trace_dispatcher_window_dispatch = 4;
}
3 changes: 2 additions & 1 deletion protos/perfetto/config/data_source_config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ message DataSourceConfig {
optional ProtoLogConfig protolog_config = 126 [lazy = true];

// Data source name: android.input.inputevent
optional AndroidInputEventConfig android_input_event_config = 128 [lazy = true];
optional AndroidInputEventConfig android_input_event_config = 128
[lazy = true];

// Data source name: android.pixel.modem
optional PixelModemConfig pixel_modem_config = 129 [lazy = true];
Expand Down
Loading

0 comments on commit bdd33a2

Please sign in to comment.