Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / native_client_sdk / src / libraries / xray / xray.h
blob32feed0a0a8c4bebc0e11d8cb950c254f94c5eb0
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. */
5 /* XRay -- a simple profiler for Native Client */
8 #ifndef LIBRARIES_XRAY_XRAY_H_
9 #define LIBRARIES_XRAY_XRAY_H_
11 #include <stdint.h>
13 #ifndef XRAY_DISABLE_BROWSER_INTEGRATION
14 #include "ppapi/c/ppb.h"
15 #endif
17 #if defined(__arm__)
18 #undef XRAY
19 #endif
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
25 #define XRAY_NO_INSTRUMENT __attribute__((no_instrument_function))
26 #define XRAY_INLINE __attribute__((always_inline, no_instrument_function))
28 #if defined(XRAY)
30 /* Do not call __XRayAnnotate* directly; instead use the */
31 /* XRayAnnotate() macros below. */
32 XRAY_NO_INSTRUMENT void __XRayAnnotate(const char* str, ...)
33 __attribute__ ((format(printf, 1, 2)));
34 XRAY_NO_INSTRUMENT void __XRayAnnotateFiltered(const uint32_t filter,
35 const char* str, ...) __attribute__ ((format(printf, 2, 3)));
37 /* This is the beginning of the public XRay API */
39 /* Ok if mapfilename is NULL, no symbols will be loaded. On glibc builds,
40 * XRay will also attempt to populate the symbol table with dladdr()
42 XRAY_NO_INSTRUMENT struct XRayTraceCapture* XRayInit(int stack_size,
43 int buffer_size,
44 int frame_count,
45 const char* mapfilename);
46 XRAY_NO_INSTRUMENT void XRayShutdown(struct XRayTraceCapture* capture);
47 XRAY_NO_INSTRUMENT void XRayStartFrame(struct XRayTraceCapture* capture);
48 XRAY_NO_INSTRUMENT void XRayEndFrame(struct XRayTraceCapture* capture);
49 XRAY_NO_INSTRUMENT void XRaySetAnnotationFilter(
50 struct XRayTraceCapture* capture, uint32_t filter);
51 XRAY_NO_INSTRUMENT void XRaySaveReport(struct XRayTraceCapture* capture,
52 const char* filename,
53 float percent_cutoff,
54 int cycle_cutoff);
55 XRAY_NO_INSTRUMENT void XRayReport(struct XRayTraceCapture* capture,
56 FILE* f,
57 float percent_cutoff,
58 int ticks_cutoff);
60 #ifndef XRAY_DISABLE_BROWSER_INTEGRATION
61 XRAY_NO_INSTRUMENT void XRayBrowserTraceReport(
62 struct XRayTraceCapture* capture);
63 XRAY_NO_INSTRUMENT void XRayRegisterBrowserInterface(
64 PPB_GetInterface get_browser_interface);
65 #endif /* XRAY_DISABLE_BROWSER_INTEGRATION */
68 #if defined(XRAY_ANNOTATE)
69 #define XRayAnnotate(...) __XRayAnnotate(__VA_ARGS__)
70 #define XRayAnnotateFiltered(...) __XRayAnnotateFiltered(__VA_ARGS__)
71 #else
72 #define XRayAnnotate(...)
73 #define XRayAnnotateFiltered(...)
74 #endif
75 /* This is the end of the public XRay API */
77 #else /* defined(XRAY) */
79 /* Builds that don't define XRAY will use these 'null' functions instead. */
81 #define XRayAnnotate(...)
82 #define XRayAnnotateFiltered(...)
84 inline struct XRayTraceCapture* XRayInit(int stack_size,
85 int buffer_size,
86 int frame_count,
87 const char* mapfilename) {
88 return NULL;
90 inline void XRayShutdown(struct XRayTraceCapture* capture) {}
91 inline void XRayStartFrame(struct XRayTraceCapture* capture) {}
92 inline void XRayEndFrame(struct XRayTraceCapture* capture) {}
93 inline void XRaySetAnnotationFilter(struct XRayTraceCapture* capture,
94 uint32_t filter) {}
95 inline void XRaySaveReport(struct XRayTraceCapture* capture,
96 const char* filename,
97 float percent_cutoff,
98 int cycle_cutoff) {}
99 inline void XRayReport(struct XRayTraceCapture* capture,
100 FILE* f,
101 float percent_cutoff,
102 int ticks_cutoff) {}
104 #ifndef XRAY_DISABLE_BROWSER_INTEGRATION
105 inline void XRayBrowserTraceReport(struct XRayTraceCapture* capture) {}
106 inline void XRayRegisterBrowserInterface(
107 PPB_GetInterface get_browser_interface) {}
108 #endif /* XRAY_DISABLE_BROWSER_INTEGRATION */
111 #endif /* defined(XRAY) */
113 #ifdef __cplusplus
115 #endif
117 #endif /* LIBRARIES_XRAY_XRAY_H_ */