OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium 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 #ifndef PPAPI_CPP_DEV_TRACE_EVENT_DEV_H_ | |
6 #define PPAPI_CPP_DEV_TRACE_EVENT_DEV_H_ | |
7 | |
8 /// @file | |
9 /// This file defines the API for Pepper plugins to add trace events. Only | |
10 /// <code>SetThreadName</code> is meant to be called directly by a developer, | |
11 /// the other functions are only used by the macros in trace_event_internal.h. | |
12 /// For details on how to instrument code, see: | |
13 /// http://www.chromium.org/developers/how-tos/trace-event-profiling-tool/tracin g-event-instrumentation | |
14 namespace pp { | |
brettw
2013/02/15 19:21:59
Blank line before this.
elijahtaylor1
2013/02/20 01:09:51
Done.
| |
15 namespace trace_events { | |
brettw
2013/02/15 19:21:59
In other places, we've had a C++ class following t
elijahtaylor1
2013/02/20 01:09:51
Done. Will roll a separate CL to rename Trace_Eve
| |
16 | |
17 /// Sets the current thread's name. This name will show up in trace captures in | |
18 /// chrome://tracing | |
19 void SetThreadName(const char* name); | |
20 | |
21 /// This function returns a pointer to a variable indicated if a particular | |
22 /// category is enabled. See comments in trace_event_internal.h for more | |
23 /// details. | |
24 const unsigned char* GetCategoryEnabled(const char* category_name); | |
25 | |
26 /// Add a trace event entry. See comments in trace_event_internal.h for more | |
27 /// details. | |
28 void AddTraceEvent(char phase, | |
29 const unsigned char* category_enabled, | |
30 const char* name, | |
31 unsigned long long id, | |
brettw
2013/02/15 19:21:59
This should match the type on the C interface (uin
elijahtaylor1
2013/02/20 01:09:51
Done. I kept the references below the same becaus
| |
32 int num_args, | |
33 const char** arg_names, | |
34 const unsigned char* arg_types, | |
35 const unsigned long long* arg_values, | |
36 unsigned char flags); | |
37 | |
38 } // namespace trace_events | |
39 } // namespace pp | |
40 | |
41 // This header is modified from Chromium's base/debug/trace_event.h to provide | |
42 // tracing through the PPB_Trace_Event_Dev interface. | |
43 | |
44 #define TRACE_EVENT_API_GET_CATEGORY_ENABLED \ | |
45 pp::trace_events::GetCategoryEnabled | |
46 | |
47 // void TRACE_EVENT_API_ADD_TRACE_EVENT( | |
48 // char phase, | |
49 // const unsigned char* category_enabled, | |
50 // const char* name, | |
51 // unsigned long long id, | |
52 // int num_args, | |
53 // const char** arg_names, | |
54 // const unsigned char* arg_types, | |
55 // const unsigned long long* arg_values, | |
56 // int threshold_begin_id, | |
57 // long long threshold, | |
58 // unsigned char flags) | |
59 #define TRACE_EVENT_API_ADD_TRACE_EVENT pp::trace_events::AddTraceEvent | |
60 | |
61 // Defines atomic operations used internally by the tracing system. | |
62 // Per comments in trace_event_internal.h these require no memory barrier, | |
63 // and the Chromium gcc versions are defined as plain int load/store. | |
64 #define TRACE_EVENT_API_ATOMIC_WORD intptr_t | |
65 #define TRACE_EVENT_API_ATOMIC_LOAD(var) (var) | |
66 #define TRACE_EVENT_API_ATOMIC_STORE(var, value) ((var) = (value)) | |
67 | |
68 // Defines visibility for classes in trace_event_internal.h. | |
69 #define TRACE_EVENT_API_CLASS_EXPORT | |
70 | |
71 #include "base/debug/trace_event_internal.h" | |
72 | |
73 #endif // PPAPI_CPP_DEV_TRACE_EVENT_DEV_H_ | |
OLD | NEW |