OLD | NEW |
1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /* XRay -- a simple profiler for Native Client */ | 6 /* XRay -- a simple profiler for Native Client */ |
7 | 7 |
8 | 8 |
9 #ifndef LIBRARIES_XRAY_XRAY_H_ | 9 #ifndef LIBRARIES_XRAY_XRAY_H_ |
10 #define LIBRARIES_XRAY_XRAY_H_ | 10 #define LIBRARIES_XRAY_XRAY_H_ |
11 | 11 |
12 #include <stdint.h> | 12 #include <stdint.h> |
13 | 13 |
14 #if defined(__arm__) | 14 #if defined(__arm__) |
15 #undef XRAY | 15 #undef XRAY |
16 #endif | 16 #endif |
17 | 17 |
18 #ifdef __cplusplus | 18 #ifdef __cplusplus |
19 extern "C" { | 19 extern "C" { |
20 #endif | 20 #endif |
21 | 21 |
22 #define XRAY_NO_INSTRUMENT __attribute__((no_instrument_function)) | 22 #define XRAY_NO_INSTRUMENT __attribute__((no_instrument_function)) |
23 #define XRAY_INLINE __attribute__((always_inline)) | 23 #define XRAY_INLINE __attribute__((always_inline, no_instrument_function)) |
24 | 24 |
25 #if defined(XRAY) | 25 #if defined(XRAY) |
26 | 26 |
27 /* Do not call __XRayAnnotate* directly; instead use the */ | 27 /* Do not call __XRayAnnotate* directly; instead use the */ |
28 /* XRayAnnotate() macros below. */ | 28 /* XRayAnnotate() macros below. */ |
29 XRAY_NO_INSTRUMENT void __XRayAnnotate(const char* str, ...) | 29 XRAY_NO_INSTRUMENT void __XRayAnnotate(const char* str, ...) |
30 __attribute__ ((format(printf, 1, 2))); | 30 __attribute__ ((format(printf, 1, 2))); |
31 XRAY_NO_INSTRUMENT void __XRayAnnotateFiltered(const uint32_t filter, | 31 XRAY_NO_INSTRUMENT void __XRayAnnotateFiltered(const uint32_t filter, |
32 const char* str, ...) __attribute__ ((format(printf, 2, 3))); | 32 const char* str, ...) __attribute__ ((format(printf, 2, 3))); |
33 | 33 |
34 /* This is the beginning of the public XRay API */ | 34 /* This is the beginning of the public XRay API */ |
| 35 |
| 36 /* Ok if mapfilename is NULL, no symbols will be loaded. On glibc builds, |
| 37 * XRay will also attempt to populate the symbol table with dladdr() |
| 38 */ |
35 XRAY_NO_INSTRUMENT void XRayInit(int stack_size, int buffer_size, | 39 XRAY_NO_INSTRUMENT void XRayInit(int stack_size, int buffer_size, |
36 int frame_count, const char* mapfilename); | 40 int frame_count, const char* mapfilename); |
37 XRAY_NO_INSTRUMENT void XRayShutdown(); | 41 XRAY_NO_INSTRUMENT void XRayShutdown(); |
38 XRAY_NO_INSTRUMENT void XRayStartFrame(); | 42 XRAY_NO_INSTRUMENT void XRayStartFrame(); |
39 XRAY_NO_INSTRUMENT void XRayEndFrame(); | 43 XRAY_NO_INSTRUMENT void XRayEndFrame(); |
40 XRAY_NO_INSTRUMENT void XRaySetAnnotationFilter(uint32_t filter); | 44 XRAY_NO_INSTRUMENT void XRaySetAnnotationFilter(uint32_t filter); |
41 XRAY_NO_INSTRUMENT void XRaySaveReport(const char* filename, float cutoff); | 45 XRAY_NO_INSTRUMENT void XRaySaveReport(const char* filename, |
| 46 float percent_cutoff, |
| 47 int cycle_cutoff); |
| 48 XRAY_NO_INSTRUMENT void XRayReport(FILE* f, |
| 49 float percent_cutoff, |
| 50 int ticks_cutoff); |
42 #if defined(XRAY_ANNOTATE) | 51 #if defined(XRAY_ANNOTATE) |
43 #define XRayAnnotate(...) __XRayAnnotate(__VA_ARGS__) | 52 #define XRayAnnotate(...) __XRayAnnotate(__VA_ARGS__) |
44 #define XRayAnnotateFiltered(...) __XRayAnnotateFiltered(__VA_ARGS__) | 53 #define XRayAnnotateFiltered(...) __XRayAnnotateFiltered(__VA_ARGS__) |
45 #else | 54 #else |
46 #define XRayAnnotate(...) | 55 #define XRayAnnotate(...) |
47 #define XRayAnnotateFiltered(...) | 56 #define XRayAnnotateFiltered(...) |
48 #endif | 57 #endif |
49 /* This is the end of the public XRay API */ | 58 /* This is the end of the public XRay API */ |
50 | 59 |
51 #else /* defined(XRAY) */ | 60 #else /* defined(XRAY) */ |
52 | 61 |
53 /* Builds that don't define XRAY will use these 'null' functions instead. */ | 62 /* Builds that don't define XRAY will use these 'null' functions instead. */ |
54 | 63 |
55 #define XRayAnnotate(...) | 64 #define XRayAnnotate(...) |
56 #define XRayAnnotateFiltered(...) | 65 #define XRayAnnotateFiltered(...) |
57 | 66 |
58 inline void XRayInit(int stack_size, int buffer_size, | 67 inline void XRayInit(int stack_size, int buffer_size, |
59 int frame_count, const char* mapfilename) {} | 68 int frame_count, const char* mapfilename) {} |
60 inline void XRayShutdown() {} | 69 inline void XRayShutdown() {} |
61 inline void XRayStartFrame() {} | 70 inline void XRayStartFrame() {} |
62 inline void XRayEndFrame() {} | 71 inline void XRayEndFrame() {} |
63 inline void XRaySetAnnotationFilter(uint32_t filter) {} | 72 inline void XRaySetAnnotationFilter(uint32_t filter) {} |
64 inline void XRaySaveReport(const char* filename, float cutoff) {} | 73 inline void XRaySaveReport(const char* filename, |
65 | 74 float percent_cutoff, |
| 75 int cycle_cutoff) {} |
| 76 inline void XRayReport(FILE* f, float percent_cutoff, int ticks_cutoff); |
66 #endif /* defined(XRAY) */ | 77 #endif /* defined(XRAY) */ |
67 | 78 |
68 #ifdef __cplusplus | 79 #ifdef __cplusplus |
69 } | 80 } |
70 #endif | 81 #endif |
71 | 82 |
72 #endif /* LIBRARIES_XRAY_XRAY_H_ */ | 83 #endif /* LIBRARIES_XRAY_XRAY_H_ */ |
73 | 84 |
OLD | NEW |