You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
cmake
docs
include
lib
BlocksRuntime
asan
builtins
cfi
dfsan
esan
fuzzer
hwasan
interception
lsan
msan
profile
CMakeLists.txt
GCDAProfiling.c
InstrProfData.inc
InstrProfiling.c
InstrProfiling.h
InstrProfilingBuffer.c
InstrProfilingFile.c
InstrProfilingInternal.h
InstrProfilingMerge.c
InstrProfilingMergeFile.c
InstrProfilingNameVar.c
InstrProfilingPlatformDarwin.c
InstrProfilingPlatformLinux.c
InstrProfilingPlatformOther.c
InstrProfilingPort.h
InstrProfilingRuntime.cc
InstrProfilingUtil.c
InstrProfilingUtil.h
InstrProfilingValue.c
InstrProfilingWriter.c
WindowsMMap.c
WindowsMMap.h
safestack
sanitizer_common
scudo
stats
tsan
ubsan
ubsan_minimal
xray
CMakeLists.txt
test
unittests
www
.arcconfig
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
README.txt
eng
libcxx
libcxxabi
libunwind
lld
lldb
llvm
nuget
openmp
polly
Directory.Build.props
Directory.Build.targets
NuGet.config
azure-pipelines.yml
build.cmd
build.sh
dir.common.props
global.json
llvm.proj
mxe-Win64.cmake.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
69 lines
2.8 KiB
C
69 lines
2.8 KiB
C
![]() |
/*===- InstrProfilingBuffer.c - Write instrumentation to a memory buffer --===*\
|
||
|
|*
|
||
|
|* The LLVM Compiler Infrastructure
|
||
|
|*
|
||
|
|* This file is distributed under the University of Illinois Open Source
|
||
|
|* License. See LICENSE.TXT for details.
|
||
|
|*
|
||
|
\*===----------------------------------------------------------------------===*/
|
||
|
|
||
|
#include "InstrProfiling.h"
|
||
|
#include "InstrProfilingInternal.h"
|
||
|
|
||
|
COMPILER_RT_VISIBILITY
|
||
|
uint64_t __llvm_profile_get_size_for_buffer(void) {
|
||
|
const __llvm_profile_data *DataBegin = __llvm_profile_begin_data();
|
||
|
const __llvm_profile_data *DataEnd = __llvm_profile_end_data();
|
||
|
const uint64_t *CountersBegin = __llvm_profile_begin_counters();
|
||
|
const uint64_t *CountersEnd = __llvm_profile_end_counters();
|
||
|
const char *NamesBegin = __llvm_profile_begin_names();
|
||
|
const char *NamesEnd = __llvm_profile_end_names();
|
||
|
|
||
|
return __llvm_profile_get_size_for_buffer_internal(
|
||
|
DataBegin, DataEnd, CountersBegin, CountersEnd, NamesBegin, NamesEnd);
|
||
|
}
|
||
|
|
||
|
COMPILER_RT_VISIBILITY
|
||
|
uint64_t __llvm_profile_get_data_size(const __llvm_profile_data *Begin,
|
||
|
const __llvm_profile_data *End) {
|
||
|
intptr_t BeginI = (intptr_t)Begin, EndI = (intptr_t)End;
|
||
|
return ((EndI + sizeof(__llvm_profile_data) - 1) - BeginI) /
|
||
|
sizeof(__llvm_profile_data);
|
||
|
}
|
||
|
|
||
|
COMPILER_RT_VISIBILITY
|
||
|
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) {
|
||
|
/* Match logic in __llvm_profile_write_buffer(). */
|
||
|
const uint64_t NamesSize = (NamesEnd - NamesBegin) * sizeof(char);
|
||
|
const uint8_t Padding = __llvm_profile_get_num_padding_bytes(NamesSize);
|
||
|
return sizeof(__llvm_profile_header) +
|
||
|
(__llvm_profile_get_data_size(DataBegin, DataEnd) *
|
||
|
sizeof(__llvm_profile_data)) +
|
||
|
(CountersEnd - CountersBegin) * sizeof(uint64_t) + NamesSize + Padding;
|
||
|
}
|
||
|
|
||
|
COMPILER_RT_VISIBILITY
|
||
|
void initBufferWriter(ProfDataWriter *BufferWriter, char *Buffer) {
|
||
|
BufferWriter->Write = lprofBufferWriter;
|
||
|
BufferWriter->WriterCtx = Buffer;
|
||
|
}
|
||
|
|
||
|
COMPILER_RT_VISIBILITY int __llvm_profile_write_buffer(char *Buffer) {
|
||
|
ProfDataWriter BufferWriter;
|
||
|
initBufferWriter(&BufferWriter, Buffer);
|
||
|
return lprofWriteData(&BufferWriter, 0, 0);
|
||
|
}
|
||
|
|
||
|
COMPILER_RT_VISIBILITY 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) {
|
||
|
ProfDataWriter BufferWriter;
|
||
|
initBufferWriter(&BufferWriter, Buffer);
|
||
|
return lprofWriteDataImpl(&BufferWriter, DataBegin, DataEnd, CountersBegin,
|
||
|
CountersEnd, 0, NamesBegin, NamesEnd, 0);
|
||
|
}
|