| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 class TraceEventMemoryOverhead; | 46 class TraceEventMemoryOverhead; |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 // This will mark the trace event as disabled by default. The user will need | 50 // This will mark the trace event as disabled by default. The user will need |
| 51 // to explicitly enable the event. | 51 // to explicitly enable the event. |
| 52 #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name | 52 #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name |
| 53 | 53 |
| 54 namespace blink { | 54 namespace blink { |
| 55 | 55 |
| 56 class TracedValue; |
| 57 |
| 56 namespace TraceEvent { | 58 namespace TraceEvent { |
| 57 typedef uint64_t TraceEventHandle; | 59 typedef uint64_t TraceEventHandle; |
| 58 typedef intptr_t TraceEventAPIAtomicWord; | 60 typedef intptr_t TraceEventAPIAtomicWord; |
| 59 | |
| 60 class PLATFORM_EXPORT ConvertableToTraceFormat : public RefCounted<ConvertableTo
TraceFormat> { | |
| 61 public: | |
| 62 virtual String asTraceFormat() const = 0; | |
| 63 virtual ~ConvertableToTraceFormat() { } | |
| 64 virtual void estimateTraceMemoryOverhead(base::trace_event::TraceEventMemory
Overhead*) { } | |
| 65 }; | |
| 66 | |
| 67 } // namespace TraceEvent | 61 } // namespace TraceEvent |
| 68 | 62 |
| 69 // FIXME: Make these global variables thread-safe. Make a value update atomic. | 63 // FIXME: Make these global variables thread-safe. Make a value update atomic. |
| 70 PLATFORM_EXPORT extern TraceEvent::TraceEventAPIAtomicWord* traceSamplingState[3
]; | 64 PLATFORM_EXPORT extern TraceEvent::TraceEventAPIAtomicWord* traceSamplingState[3
]; |
| 71 | 65 |
| 72 class PLATFORM_EXPORT EventTracer { | 66 class PLATFORM_EXPORT EventTracer { |
| 73 STATIC_ONLY(EventTracer); | 67 STATIC_ONLY(EventTracer); |
| 74 public: | 68 public: |
| 75 static void initialize(); | 69 static void initialize(); |
| 76 static const unsigned char* getTraceCategoryEnabledFlag(const char*); | 70 static const unsigned char* getTraceCategoryEnabledFlag(const char*); |
| 77 static TraceEvent::TraceEventHandle addTraceEvent(char phase, | 71 static TraceEvent::TraceEventHandle addTraceEvent(char phase, |
| 78 const unsigned char* categoryEnabledFlag, | 72 const unsigned char* categoryEnabledFlag, |
| 79 const char* name, | 73 const char* name, |
| 80 unsigned long long id, | 74 unsigned long long id, |
| 81 unsigned long long bindId, | 75 unsigned long long bindId, |
| 82 double timestamp, | 76 double timestamp, |
| 83 int numArgs, | 77 int numArgs, |
| 84 const char* argNames[], | 78 const char* argNames[], |
| 85 const unsigned char argTypes[], | 79 const unsigned char argTypes[], |
| 86 const unsigned long long argValues[], | 80 const unsigned long long argValues[], |
| 87 PassRefPtr<TraceEvent::ConvertableToTraceFormat>, | 81 PassRefPtr<TracedValue>, |
| 88 PassRefPtr<TraceEvent::ConvertableToTraceFormat>, | 82 PassRefPtr<TracedValue>, |
| 89 unsigned flags); | 83 unsigned flags); |
| 90 static TraceEvent::TraceEventHandle addTraceEvent(char phase, | 84 static TraceEvent::TraceEventHandle addTraceEvent(char phase, |
| 91 const unsigned char* categoryEnabledFlag, | 85 const unsigned char* categoryEnabledFlag, |
| 92 const char* name, | 86 const char* name, |
| 93 unsigned long long id, | 87 unsigned long long id, |
| 94 unsigned long long bindId, | 88 unsigned long long bindId, |
| 95 double timestamp, | 89 double timestamp, |
| 96 int numArgs, | 90 int numArgs, |
| 97 const char* argNames[], | 91 const char* argNames[], |
| 98 const unsigned char argTypes[], | 92 const unsigned char argTypes[], |
| (...skipping 13 matching lines...) Expand all Loading... |
| 112 const char* argNames[], | 106 const char* argNames[], |
| 113 const unsigned char argTypes[], | 107 const unsigned char argTypes[], |
| 114 const unsigned long long argValues[], | 108 const unsigned long long argValues[], |
| 115 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>* conver
tables, | 109 const scoped_refptr<base::trace_event::ConvertableToTraceFormat>* conver
tables, |
| 116 unsigned flags); | 110 unsigned flags); |
| 117 }; | 111 }; |
| 118 | 112 |
| 119 } // namespace blink | 113 } // namespace blink |
| 120 | 114 |
| 121 #endif // EventTracer_h | 115 #endif // EventTracer_h |
| OLD | NEW |