event_tracer.cpp (1717B)
1 // Copyright 2012 The ANGLE Project Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "common/event_tracer.h" 6 7 #include "common/debug.h" 8 9 namespace angle 10 { 11 12 const unsigned char *GetTraceCategoryEnabledFlag(PlatformMethods *platform, const char *name) 13 { 14 ASSERT(platform); 15 16 const unsigned char *categoryEnabledFlag = 17 platform->getTraceCategoryEnabledFlag(platform, name); 18 if (categoryEnabledFlag != nullptr) 19 { 20 return categoryEnabledFlag; 21 } 22 23 static unsigned char disabled = 0; 24 return &disabled; 25 } 26 27 angle::TraceEventHandle AddTraceEvent(PlatformMethods *platform, 28 char phase, 29 const unsigned char *categoryGroupEnabled, 30 const char *name, 31 unsigned long long id, 32 int numArgs, 33 const char **argNames, 34 const unsigned char *argTypes, 35 const unsigned long long *argValues, 36 unsigned char flags) 37 { 38 ASSERT(platform); 39 40 double timestamp = platform->monotonicallyIncreasingTime(platform); 41 42 if (timestamp != 0) 43 { 44 angle::TraceEventHandle handle = 45 platform->addTraceEvent(platform, phase, categoryGroupEnabled, name, id, timestamp, 46 numArgs, argNames, argTypes, argValues, flags); 47 return handle; 48 } 49 50 return static_cast<angle::TraceEventHandle>(0); 51 } 52 53 } // namespace angle