aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ProfileData/MemProfTest.cpp
diff options
context:
space:
mode:
authorSnehasish Kumar <snehasishk@google.com>2022-02-17 15:45:10 -0800
committerSnehasish Kumar <snehasishk@google.com>2022-02-17 15:51:04 -0800
commit19bdf44d850884a13a8708ccf1260fb7f4ef4eb3 (patch)
treedcf0f37859e572fb8b3365cc24642d247d701a17 /llvm/unittests/ProfileData/MemProfTest.cpp
parent27b7c1e3f5e01b00781c6cc0d19e8f0446e79d9f (diff)
downloadllvm-19bdf44d850884a13a8708ccf1260fb7f4ef4eb3.zip
llvm-19bdf44d850884a13a8708ccf1260fb7f4ef4eb3.tar.gz
llvm-19bdf44d850884a13a8708ccf1260fb7f4ef4eb3.tar.bz2
Revert "Reland "[memprof] Extend the index prof format to include memory profiles.""
This reverts commit 807ba7aace188ada83ddb4477265728e97346af1.
Diffstat (limited to 'llvm/unittests/ProfileData/MemProfTest.cpp')
-rw-r--r--llvm/unittests/ProfileData/MemProfTest.cpp54
1 files changed, 2 insertions, 52 deletions
diff --git a/llvm/unittests/ProfileData/MemProfTest.cpp b/llvm/unittests/ProfileData/MemProfTest.cpp
index dc79317..f744b85 100644
--- a/llvm/unittests/ProfileData/MemProfTest.cpp
+++ b/llvm/unittests/ProfileData/MemProfTest.cpp
@@ -89,8 +89,8 @@ const DILineInfoSpecifier specifier() {
DILineInfoSpecifier::FunctionNameKind::LinkageName);
}
-MATCHER_P4(FrameContains, FunctionName, LineOffset, Column, Inline, "") {
- const uint64_t ExpectedHash = llvm::Function::getGUID(FunctionName);
+MATCHER_P4(FrameContains, Function, LineOffset, Column, Inline, "") {
+ const std::string ExpectedHash = std::to_string(llvm::MD5Hash(Function));
if (arg.Function != ExpectedHash) {
*result_listener << "Hash mismatch";
return false;
@@ -103,22 +103,6 @@ MATCHER_P4(FrameContains, FunctionName, LineOffset, Column, Inline, "") {
return false;
}
-MATCHER_P(EqualsRecord, Want, "") {
- if (arg == Want)
- return true;
-
- std::string Explanation;
- llvm::raw_string_ostream OS(Explanation);
- OS << "\n Want: \n";
- Want.print(OS);
- OS << "\n Got: \n";
- arg.print(OS);
- OS.flush();
-
- *result_listener << Explanation;
- return false;
-}
-
MemProfSchema getFullSchema() {
MemProfSchema Schema;
#define MIBEntryDef(NameTag, Name, Type) Schema.push_back(Meta::Name);
@@ -200,38 +184,4 @@ TEST(MemProf, PortableWrapper) {
EXPECT_EQ(3UL, ReadBlock.getAllocCpuId());
}
-TEST(MemProf, RecordSerializationRoundTrip) {
- const MemProfSchema Schema = getFullSchema();
-
- llvm::SmallVector<MemProfRecord, 3> Records;
- MemProfRecord MR;
-
- MemInfoBlock Info(/*size=*/16, /*access_count=*/7, /*alloc_timestamp=*/1000,
- /*dealloc_timestamp=*/2000, /*alloc_cpu=*/3,
- /*dealloc_cpu=*/4);
-
- MR.Info = PortableMemInfoBlock(Info);
- MR.CallStack.push_back({0x123, 1, 2, false});
- MR.CallStack.push_back({0x345, 3, 4, false});
- Records.push_back(MR);
-
- MR.clear();
- MR.Info = PortableMemInfoBlock(Info);
- MR.CallStack.push_back({0x567, 5, 6, false});
- MR.CallStack.push_back({0x789, 7, 8, false});
- Records.push_back(MR);
-
- std::string Buffer;
- llvm::raw_string_ostream OS(Buffer);
- serializeRecords(Records, Schema, OS);
- OS.flush();
-
- const llvm::SmallVector<MemProfRecord, 4> GotRecords = deserializeRecords(
- Schema, reinterpret_cast<const unsigned char *>(Buffer.data()));
-
- ASSERT_TRUE(!GotRecords.empty());
- EXPECT_EQ(GotRecords.size(), Records.size());
- EXPECT_THAT(GotRecords[0], EqualsRecord(Records[0]));
- EXPECT_THAT(GotRecords[1], EqualsRecord(Records[1]));
-}
} // namespace