Hash :
23c1e11e
        
        Author :
  
        
        Date :
2025-04-01T11:27:02
        
      
Disable platform trace events by default, except Chromium build Observed overhead in perf builds is too significant, some workloads generate thousands of events per second. There does not seem to be a simple way to get around the overhead - it could be somewhat reduced but the event rate is just too high. ANGLE_TRACE_EVENT*(...) etc become a no-op by default. Can be re-enabled with angle_enable_platform_trace_events=true gn arg Bug: angleproject:404542398 Change-Id: I8d7363ee28d22226f1860e24f2399bb4129cfb84 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6419308 Commit-Queue: Roman Lavrov <romanl@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Feels: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
//
// Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// trace.h: Wrappers for ANGLE trace event functions.
//
#ifndef LIBANGLE_TRACE_H_
#define LIBANGLE_TRACE_H_
#include <platform/PlatformMethods.h>
#include "common/base/anglebase/trace_event/trace_event.h"
#if defined(ANGLE_ENABLE_PLATFORM_TRACE_EVENTS)
// TODO: Pass platform directly to these methods. http://anglebug.com/42260698
#    define ANGLE_TRACE_EVENT_BEGIN(CATEGORY, EVENT, ...) \
        TRACE_EVENT_BEGIN(ANGLEPlatformCurrent(), CATEGORY, EVENT, ##__VA_ARGS__)
#    define ANGLE_TRACE_EVENT_END(CATEGORY, EVENT, ...) \
        TRACE_EVENT_END(ANGLEPlatformCurrent(), CATEGORY, EVENT, ##__VA_ARGS__)
#    define ANGLE_TRACE_EVENT_INSTANT(CATEGORY, EVENT, ...) \
        TRACE_EVENT_INSTANT(ANGLEPlatformCurrent(), CATEGORY, EVENT, ##__VA_ARGS__)
#    define ANGLE_TRACE_EVENT(CATEGORY, EVENT, ...) \
        TRACE_EVENT(ANGLEPlatformCurrent(), CATEGORY, EVENT, ##__VA_ARGS__)
#else  // !defined(ANGLE_ENABLE_PLATFORM_TRACE_EVENTS)
#    define ANGLE_TRACE_EVENT_BEGIN(CATEGORY, EVENT, ...) ((void)0)
#    define ANGLE_TRACE_EVENT_END(CATEGORY, EVENT, ...) ((void)0)
#    define ANGLE_TRACE_EVENT_INSTANT(CATEGORY, EVENT, ...) ((void)0)
#    define ANGLE_TRACE_EVENT(CATEGORY, EVENT, ...) ((void)0)
#endif  // defined(ANGLE_ENABLE_PLATFORM_TRACE_EVENTS)
// Deprecated, use ANGLE_TRACE_EVENT_BEGIN
#define ANGLE_TRACE_EVENT_BEGIN0(CATEGORY, EVENT) ANGLE_TRACE_EVENT_BEGIN(CATEGORY, EVENT)
// Deprecated, use ANGLE_TRACE_EVENT_END
#define ANGLE_TRACE_EVENT_END0(CATEGORY, EVENT) ANGLE_TRACE_EVENT_END(CATEGORY, EVENT)
// Deprecated, use ANGLE_TRACE_EVENT_INSTANT
#define ANGLE_TRACE_EVENT_INSTANT0(CATEGORY, EVENT) ANGLE_TRACE_EVENT_INSTANT(CATEGORY, EVENT)
// Deprecated, use ANGLE_TRACE_EVENT
#define ANGLE_TRACE_EVENT0(CATEGORY, EVENT) ANGLE_TRACE_EVENT(CATEGORY, EVENT)
// Deprecated, use ANGLE_TRACE_EVENT
#define ANGLE_TRACE_EVENT1(CATEGORY, EVENT, NAME, VAL) ANGLE_TRACE_EVENT(CATEGORY, EVENT, NAME, VAL)
#endif  // LIBANGLE_TRACE_H_