Hash :
19e45680
Author :
Date :
2025-03-18T12:50:52
Disable timestamp call from AddTraceEvent for Android platform Android platform's addTraceEvent ignores the timestamp arg, so there is no reason to make this call (and it shows as the hotspot). Behind a new define to avoid breaking this in Chromium Android builds where the timestamp is actually used. Bug: angleproject:404542398 Change-Id: I0f5eea31feb6838c3e62949fcd2947145be4ebf5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6368277 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Roman Lavrov <romanl@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 51 52 53 54 55 56 57
// Copyright 2012 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.
#include "common/event_tracer.h"
#include "common/debug.h"
namespace angle
{
const unsigned char *GetTraceCategoryEnabledFlag(PlatformMethods *platform, const char *name)
{
ASSERT(platform);
const unsigned char *categoryEnabledFlag =
platform->getTraceCategoryEnabledFlag(platform, name);
if (categoryEnabledFlag != nullptr)
{
return categoryEnabledFlag;
}
static unsigned char disabled = 0;
return &disabled;
}
angle::TraceEventHandle AddTraceEvent(PlatformMethods *platform,
char phase,
const unsigned char *categoryGroupEnabled,
const char *name,
unsigned long long id,
int numArgs,
const char **argNames,
const unsigned char *argTypes,
const unsigned long long *argValues,
unsigned char flags)
{
ASSERT(platform);
#if defined(ANGLE_TRACE_EVENTS_IGNORE_TIMESTAMP)
double timestamp = 1.0; // Value doesn't matter, not used by the callback.
#else
double timestamp = platform->monotonicallyIncreasingTime(platform);
#endif
if (timestamp != 0)
{
angle::TraceEventHandle handle =
platform->addTraceEvent(platform, phase, categoryGroupEnabled, name, id, timestamp,
numArgs, argNames, argTypes, argValues, flags);
return handle;
}
return static_cast<angle::TraceEventHandle>(0);
}
} // namespace angle