blob: 375792547291ce89703dee80d41cead355ff9184 [file] [log] [blame]
hclam@chromium.orgad7efa62012-12-11 21:19:08 +00001/*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11// This file defines the interface for event tracing in WebRTC.
12//
13// Event log handlers are set through SetupEventTracer(). User of this API will
14// provide two function pointers to handle event tracing calls.
15//
16// * GetCategoryEnabledPtr
17// Event tracing system calls this function to determine if a particular
18// event category is enabled.
19//
20// * AddTraceEventPtr
21// Adds a tracing event. It is the user's responsibility to log the data
22// provided.
23//
24// Parameters for the above two functions are described in trace_event.h.
25
26#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_EVENT_TRACER_H_
27#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_EVENT_TRACER_H_
28
29#include "webrtc/common_types.h"
30
31namespace webrtc {
32
33typedef const unsigned char* (*GetCategoryEnabledPtr)(const char* name);
34typedef int (*AddTraceEventPtr)(char phase,
35 const unsigned char* category_enabled,
36 const char* name,
37 unsigned long long id,
38 int num_args,
39 const char** arg_names,
40 const unsigned char* arg_types,
41 const unsigned long long* arg_values,
42 int threshold_begin_id,
43 long long threshold,
44 unsigned char flags);
45
46// User of WebRTC can call this method to setup event tracing.
47//
48// This method must be called before any WebRTC methods. Functions
49// provided should be thread-safe.
50WEBRTC_DLLEXPORT void SetupEventTracer(
51 GetCategoryEnabledPtr get_category_enabled_ptr,
52 AddTraceEventPtr add_trace_event_ptr);
53
54// This class defines interface for the event tracing system to call
55// internally. Do not call these methods directly.
56class EventTracer {
57 public:
58 static const unsigned char* GetCategoryEnabled(
59 const char* name);
60
61 static int AddTraceEvent(
62 char phase,
63 const unsigned char* category_enabled,
64 const char* name,
65 unsigned long long id,
66 int num_args,
67 const char** arg_names,
68 const unsigned char* arg_types,
69 const unsigned long long* arg_values,
70 int threshold_begin_id,
71 long long threshold,
72 unsigned char flags);
73};
74
75} // namespace webrtc
76
77#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_EVENT_TRACER_H_