diff options
Diffstat (limited to 'compiler-rt/lib/profile/InstrProfiling.h')
| -rw-r--r-- | compiler-rt/lib/profile/InstrProfiling.h | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/compiler-rt/lib/profile/InstrProfiling.h b/compiler-rt/lib/profile/InstrProfiling.h index 17d3fd42401..d3600accf9f 100644 --- a/compiler-rt/lib/profile/InstrProfiling.h +++ b/compiler-rt/lib/profile/InstrProfiling.h @@ -7,8 +7,10 @@ |* \*===----------------------------------------------------------------------===*/ +#ifndef PROFILE_INSTRPROFILING_H__ +#define PROFILE_INSTRPROFILING_H__ + #include <stdio.h> -#include <stdlib.h> #define I386_FREEBSD (defined(__FreeBSD__) && defined(__i386__)) @@ -40,7 +42,7 @@ typedef struct __llvm_profile_data { uint64_t *const Counters; } __llvm_profile_data; -/* TODO: void __llvm_profile_get_size_for_buffer(void); */ +/* TODO: void __llvm_profile_get_size_for_buffer(void); */ /*! * \brief Write instrumentation data to the given buffer. @@ -57,3 +59,37 @@ const char *__llvm_profile_names_begin(void); const char *__llvm_profile_names_end(void); uint64_t *__llvm_profile_counters_begin(void); uint64_t *__llvm_profile_counters_end(void); + +#define PROFILE_RANGE_SIZE(Range) \ + (__llvm_profile_ ## Range ## _end() - __llvm_profile_ ## Range ## _begin()) + +/*! + * \brief Write instrumentation data to the current file. + * + * Writes to the file with the last name given to \a __llvm_profile_set_filename(), + * or if it hasn't been called, the \c LLVM_PROFILE_FILE environment variable, + * or if that's not set, \c "default.profdata". + */ +int __llvm_profile_write_file(void); + +/*! + * \brief Set the filename for writing instrumentation data. + * + * Sets the filename to be used for subsequent calls to + * \a __llvm_profile_write_file(). + * + * \c Name is not copied, so it must remain valid. Passing NULL resets the + * filename logic to the default behaviour. + */ +void __llvm_profile_set_filename(const char *Name); + +/*! \brief Register to write instrumentation data to file at exit. */ +int __llvm_profile_register_write_file_atexit(void); + +/*! \brief Get the magic token for the file format. */ +uint64_t __llvm_profile_get_magic(void); + +/*! \brief Get the version of the file format. */ +uint64_t __llvm_profile_get_version(void); + +#endif /* PROFILE_INSTRPROFILING_H__ */ |

