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)) |
bradn
2013/06/27 23:01:24
Semi-ambiguous given this an attribute, but normal
nfullagar1
2013/06/27 23:41:55
space added
| |
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 XRAY_NO_INSTRUMENT void XRayInit(int stack_size, int buffer_size, | 35 XRAY_NO_INSTRUMENT void XRayInit(int stack_size, int buffer_size, |
36 int frame_count, const char* mapfilename); | 36 int frame_count, const char* mapfilename); |
37 XRAY_NO_INSTRUMENT void XRayShutdown(); | 37 XRAY_NO_INSTRUMENT void XRayShutdown(); |
38 XRAY_NO_INSTRUMENT void XRayStartFrame(); | 38 XRAY_NO_INSTRUMENT void XRayStartFrame(); |
39 XRAY_NO_INSTRUMENT void XRayEndFrame(); | 39 XRAY_NO_INSTRUMENT void XRayEndFrame(); |
40 XRAY_NO_INSTRUMENT void XRaySetAnnotationFilter(uint32_t filter); | 40 XRAY_NO_INSTRUMENT void XRaySetAnnotationFilter(uint32_t filter); |
41 XRAY_NO_INSTRUMENT void XRaySaveReport(const char* filename, float cutoff); | 41 XRAY_NO_INSTRUMENT void XRaySaveReport(const char* filename, |
42 float percent_cutoff, | |
43 int cycle_cutoff); | |
44 XRAY_NO_INSTRUMENT void XRayReport(FILE* f, | |
45 float percent_cutoff, | |
46 int ticks_cutoff); | |
42 #if defined(XRAY_ANNOTATE) | 47 #if defined(XRAY_ANNOTATE) |
43 #define XRayAnnotate(...) __XRayAnnotate(__VA_ARGS__) | 48 #define XRayAnnotate(...) __XRayAnnotate(__VA_ARGS__) |
44 #define XRayAnnotateFiltered(...) __XRayAnnotateFiltered(__VA_ARGS__) | 49 #define XRayAnnotateFiltered(...) __XRayAnnotateFiltered(__VA_ARGS__) |
45 #else | 50 #else |
46 #define XRayAnnotate(...) | 51 #define XRayAnnotate(...) |
47 #define XRayAnnotateFiltered(...) | 52 #define XRayAnnotateFiltered(...) |
48 #endif | 53 #endif |
49 /* This is the end of the public XRay API */ | 54 /* This is the end of the public XRay API */ |
50 | 55 |
51 #else /* defined(XRAY) */ | 56 #else /* defined(XRAY) */ |
52 | 57 |
53 /* Builds that don't define XRAY will use these 'null' functions instead. */ | 58 /* Builds that don't define XRAY will use these 'null' functions instead. */ |
54 | 59 |
55 #define XRayAnnotate(...) | 60 #define XRayAnnotate(...) |
56 #define XRayAnnotateFiltered(...) | 61 #define XRayAnnotateFiltered(...) |
57 | 62 |
58 inline void XRayInit(int stack_size, int buffer_size, | 63 inline void XRayInit(int stack_size, int buffer_size, |
59 int frame_count, const char* mapfilename) {} | 64 int frame_count, const char* mapfilename) {} |
bradn
2013/06/27 23:01:24
Maybe a comment mentioning NULL for no mapfile?
nfullagar1
2013/06/27 23:41:55
Done.
| |
60 inline void XRayShutdown() {} | 65 inline void XRayShutdown() {} |
61 inline void XRayStartFrame() {} | 66 inline void XRayStartFrame() {} |
62 inline void XRayEndFrame() {} | 67 inline void XRayEndFrame() {} |
63 inline void XRaySetAnnotationFilter(uint32_t filter) {} | 68 inline void XRaySetAnnotationFilter(uint32_t filter) {} |
64 inline void XRaySaveReport(const char* filename, float cutoff) {} | 69 inline void XRaySaveReport(const char* filename, |
65 | 70 float percent_cutoff, |
71 int cycle_cutoff) {} | |
72 inline void XRayReport(FILE *f, float percent_cutoff, int ticks_cutoff); | |
bradn
2013/06/27 23:01:24
FILE*
nfullagar1
2013/06/27 23:41:55
Done.
| |
66 #endif /* defined(XRAY) */ | 73 #endif /* defined(XRAY) */ |
67 | 74 |
68 #ifdef __cplusplus | 75 #ifdef __cplusplus |
69 } | 76 } |
70 #endif | 77 #endif |
71 | 78 |
72 #endif /* LIBRARIES_XRAY_XRAY_H_ */ | 79 #endif /* LIBRARIES_XRAY_XRAY_H_ */ |
73 | 80 |
OLD | NEW |