summaryrefslogtreecommitdiff
path: root/lib/profile/InstrProfilingInternal.h
blob: 518e6a320fd7ae0b73e42cbc9ade667c7ae54c7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*===- InstrProfiling.h- Support library for PGO instrumentation ----------===*\
|*
|*                     The LLVM Compiler Infrastructure
|*
|* This file is distributed under the University of Illinois Open Source
|* License. See LICENSE.TXT for details.
|*
\*===----------------------------------------------------------------------===*/

#ifndef PROFILE_INSTRPROFILING_INTERNALH_
#define PROFILE_INSTRPROFILING_INTERNALH_

#include "InstrProfiling.h"
#include "stddef.h"

/*!
 * \brief Write instrumentation data to the given buffer, given explicit
 * pointers to the live data in memory.  This function is probably not what you
 * want.  Use __llvm_profile_get_size_for_buffer instead.  Use this function if
 * your program has a custom memory layout.
 */
uint64_t __llvm_profile_get_size_for_buffer_internal(
    const __llvm_profile_data *DataBegin, const __llvm_profile_data *DataEnd,
    const uint64_t *CountersBegin, const uint64_t *CountersEnd,
    const char *NamesBegin, const char *NamesEnd);

/*!
 * \brief Write instrumentation data to the given buffer, given explicit
 * pointers to the live data in memory.  This function is probably not what you
 * want.  Use __llvm_profile_write_buffer instead.  Use this function if your
 * program has a custom memory layout.
 *
 * \pre \c Buffer is the start of a buffer at least as big as \a
 * __llvm_profile_get_size_for_buffer_internal().
 */
int __llvm_profile_write_buffer_internal(
    char *Buffer, const __llvm_profile_data *DataBegin,
    const __llvm_profile_data *DataEnd, const uint64_t *CountersBegin,
    const uint64_t *CountersEnd, const char *NamesBegin, const char *NamesEnd);

/*!
 * This is an internal function not intended to be used externally.
 */
typedef size_t (*WriterCallback)(const void *Data, size_t ElmS, size_t NumElm,
                                 void **BufferOrFile);
int llvmWriteProfData(void *WriterCtx, WriterCallback Writer,
                      const uint8_t *ValueDataBegin,
                      const uint64_t ValueDataSize);
int llvmWriteProfDataImpl(void *WriterCtx, WriterCallback Writer,
                          const __llvm_profile_data *DataBegin,
                          const __llvm_profile_data *DataEnd,
                          const uint64_t *CountersBegin,
                          const uint64_t *CountersEnd,
                          const uint8_t *ValueDataBegin,
                          const uint64_t ValueDataSize, const char *NamesBegin,
                          const char *NamesEnd);

#endif