Home | History | Annotate | Download | only in profile
      1 /*===- InstrProfiling.h- Support library for PGO instrumentation ----------===*\
      2 |*
      3 |*                     The LLVM Compiler Infrastructure
      4 |*
      5 |* This file is distributed under the University of Illinois Open Source
      6 |* License. See LICENSE.TXT for details.
      7 |*
      8 \*===----------------------------------------------------------------------===*/
      9 
     10 #ifndef PROFILE_INSTRPROFILING_INTERNALH_
     11 #define PROFILE_INSTRPROFILING_INTERNALH_
     12 
     13 #include "InstrProfiling.h"
     14 #include "stddef.h"
     15 
     16 /*!
     17  * \brief Write instrumentation data to the given buffer, given explicit
     18  * pointers to the live data in memory.  This function is probably not what you
     19  * want.  Use __llvm_profile_get_size_for_buffer instead.  Use this function if
     20  * your program has a custom memory layout.
     21  */
     22 uint64_t __llvm_profile_get_size_for_buffer_internal(
     23     const __llvm_profile_data *DataBegin, const __llvm_profile_data *DataEnd,
     24     const uint64_t *CountersBegin, const uint64_t *CountersEnd,
     25     const char *NamesBegin, const char *NamesEnd);
     26 
     27 /*!
     28  * \brief Write instrumentation data to the given buffer, given explicit
     29  * pointers to the live data in memory.  This function is probably not what you
     30  * want.  Use __llvm_profile_write_buffer instead.  Use this function if your
     31  * program has a custom memory layout.
     32  *
     33  * \pre \c Buffer is the start of a buffer at least as big as \a
     34  * __llvm_profile_get_size_for_buffer_internal().
     35  */
     36 int __llvm_profile_write_buffer_internal(
     37     char *Buffer, const __llvm_profile_data *DataBegin,
     38     const __llvm_profile_data *DataEnd, const uint64_t *CountersBegin,
     39     const uint64_t *CountersEnd, const char *NamesBegin, const char *NamesEnd);
     40 
     41 /*!
     42  * This is an internal function not intended to be used externally.
     43  */
     44 typedef struct ProfDataIOVec {
     45   const void *Data;
     46   size_t ElmSize;
     47   size_t NumElm;
     48 } ProfDataIOVec;
     49 
     50 typedef uint32_t (*WriterCallback)(ProfDataIOVec *, uint32_t NumIOVecs,
     51                                    void **WriterCtx);
     52 int llvmWriteProfData(WriterCallback Writer, void *WriterCtx,
     53                       const uint8_t *ValueDataBegin,
     54                       const uint64_t ValueDataSize);
     55 int llvmWriteProfDataImpl(WriterCallback Writer, void *WriterCtx,
     56                           const __llvm_profile_data *DataBegin,
     57                           const __llvm_profile_data *DataEnd,
     58                           const uint64_t *CountersBegin,
     59                           const uint64_t *CountersEnd,
     60                           const uint8_t *ValueDataBegin,
     61                           const uint64_t ValueDataSize, const char *NamesBegin,
     62                           const char *NamesEnd);
     63 
     64 extern char *(*GetEnvHook)(const char *);
     65 
     66 #endif
     67