Hash :
3ea463bf
Author :
Date :
2019-06-19T14:21:33
Move event tracer back into common. Requires that we update the TRACE_EVENT macros to accept a platform as an argument. The refactor isn't complete. In order to finish we'd need to ensure we have the Display's PlatformMethods available at all sites. Unblocks adding trace events directly in the perf tests. Bug: angleproject:1892 Bug: angleproject:3117 Change-Id: Iee0ca086ccfe23acab3fc186fb042f018711a94c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1664794 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
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
// Copyright (c) 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);
double timestamp = platform->monotonicallyIncreasingTime(platform);
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