summaryrefslogtreecommitdiff
path: root/lib/ProfileData/SampleProfWriter.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-12-18 20:10:56 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-12-18 20:10:56 +0000
commit044eb2f6afba375a914ac9d8024f8f5142bb912e (patch)
tree1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /lib/ProfileData/SampleProfWriter.cpp
parenteb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff)
Notes
Diffstat (limited to 'lib/ProfileData/SampleProfWriter.cpp')
-rw-r--r--lib/ProfileData/SampleProfWriter.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/ProfileData/SampleProfWriter.cpp b/lib/ProfileData/SampleProfWriter.cpp
index b45026140c99..59c4885fcdbe 100644
--- a/lib/ProfileData/SampleProfWriter.cpp
+++ b/lib/ProfileData/SampleProfWriter.cpp
@@ -222,7 +222,10 @@ std::error_code SampleProfileWriterBinary::writeBody(const FunctionSamples &S) {
}
// Recursively emit all the callsite samples.
- encodeULEB128(S.getCallsiteSamples().size(), OS);
+ uint64_t NumCallsites = 0;
+ for (const auto &J : S.getCallsiteSamples())
+ NumCallsites += J.second.size();
+ encodeULEB128(NumCallsites, OS);
for (const auto &J : S.getCallsiteSamples())
for (const auto &FS : J.second) {
LineLocation Loc = J.first;
@@ -248,8 +251,6 @@ std::error_code SampleProfileWriterBinary::write(const FunctionSamples &S) {
///
/// \param Filename The file to create.
///
-/// \param Writer The writer to instantiate according to the specified format.
-///
/// \param Format Encoding format for the profile file.
///
/// \returns an error code indicating the status of the created writer.
@@ -271,8 +272,6 @@ SampleProfileWriter::create(StringRef Filename, SampleProfileFormat Format) {
///
/// \param OS The output stream to store the profile data to.
///
-/// \param Writer The writer to instantiate according to the specified format.
-///
/// \param Format Encoding format for the profile file.
///
/// \returns an error code indicating the status of the created writer.