Chromium Code Reviews| Index: ppapi/cpp/dev/trace_event_dev.h |
| diff --git a/ppapi/cpp/dev/trace_event_dev.h b/ppapi/cpp/dev/trace_event_dev.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..719e5310bd18f8ca0032c452384a898c590c7096 |
| --- /dev/null |
| +++ b/ppapi/cpp/dev/trace_event_dev.h |
| @@ -0,0 +1,73 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef PPAPI_CPP_DEV_TRACE_EVENT_DEV_H_ |
| +#define PPAPI_CPP_DEV_TRACE_EVENT_DEV_H_ |
| + |
| +/// @file |
| +/// This file defines the API for Pepper plugins to add trace events. Only |
| +/// <code>SetThreadName</code> is meant to be called directly by a developer, |
| +/// the other functions are only used by the macros in trace_event_internal.h. |
| +/// For details on how to instrument code, see: |
| +/// http://www.chromium.org/developers/how-tos/trace-event-profiling-tool/tracing-event-instrumentation |
| +namespace pp { |
|
brettw
2013/02/15 19:21:59
Blank line before this.
elijahtaylor1
2013/02/20 01:09:51
Done.
|
| +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
|
| + |
| +/// Sets the current thread's name. This name will show up in trace captures in |
| +/// chrome://tracing |
| +void SetThreadName(const char* name); |
| + |
| +/// This function returns a pointer to a variable indicated if a particular |
| +/// category is enabled. See comments in trace_event_internal.h for more |
| +/// details. |
| +const unsigned char* GetCategoryEnabled(const char* category_name); |
| + |
| +/// Add a trace event entry. See comments in trace_event_internal.h for more |
| +/// details. |
| +void AddTraceEvent(char phase, |
| + const unsigned char* category_enabled, |
| + const char* name, |
| + 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
|
| + int num_args, |
| + const char** arg_names, |
| + const unsigned char* arg_types, |
| + const unsigned long long* arg_values, |
| + unsigned char flags); |
| + |
| +} // namespace trace_events |
| +} // namespace pp |
| + |
| +// This header is modified from Chromium's base/debug/trace_event.h to provide |
| +// tracing through the PPB_Trace_Event_Dev interface. |
| + |
| +#define TRACE_EVENT_API_GET_CATEGORY_ENABLED \ |
| + pp::trace_events::GetCategoryEnabled |
| + |
| +// void TRACE_EVENT_API_ADD_TRACE_EVENT( |
| +// char phase, |
| +// const unsigned char* category_enabled, |
| +// const char* name, |
| +// unsigned long long id, |
| +// int num_args, |
| +// const char** arg_names, |
| +// const unsigned char* arg_types, |
| +// const unsigned long long* arg_values, |
| +// int threshold_begin_id, |
| +// long long threshold, |
| +// unsigned char flags) |
| +#define TRACE_EVENT_API_ADD_TRACE_EVENT pp::trace_events::AddTraceEvent |
| + |
| +// Defines atomic operations used internally by the tracing system. |
| +// Per comments in trace_event_internal.h these require no memory barrier, |
| +// and the Chromium gcc versions are defined as plain int load/store. |
| +#define TRACE_EVENT_API_ATOMIC_WORD intptr_t |
| +#define TRACE_EVENT_API_ATOMIC_LOAD(var) (var) |
| +#define TRACE_EVENT_API_ATOMIC_STORE(var, value) ((var) = (value)) |
| + |
| +// Defines visibility for classes in trace_event_internal.h. |
| +#define TRACE_EVENT_API_CLASS_EXPORT |
| + |
| +#include "base/debug/trace_event_internal.h" |
| + |
| +#endif // PPAPI_CPP_DEV_TRACE_EVENT_DEV_H_ |