History log of /llvm-project/llvm/unittests/ProfileData/MemProfTest.cpp (Results 1 – 25 of 94)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7
# 10d054e9 19-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Introduce IndexedCallstackIdConveter (NFC) (#120540)

This patch introduces IndexedCallstackIdConveter as a convenience
wrapper around FrameIdConverter and CallStackIdConverter just for
t

[memprof] Introduce IndexedCallstackIdConveter (NFC) (#120540)

This patch introduces IndexedCallstackIdConveter as a convenience
wrapper around FrameIdConverter and CallStackIdConverter just for
tests.

With the new wrapper, we get to replace idioms like:

FrameIdConverter<decltype(MemProfData.Frames)> FrameIdConv(
MemProfData.Frames);
CallStackIdConverter<decltype(MemProfData.CallStacks)> CSIdConv(
MemProfData.CallStacks, FrameIdConv);

with:

IndexedCallstackIdConveter CSIdConv(MemProfData);

Unfortunately, this exact pattern occurs in tests only; the
combinations of the frame ID converter and call stack ID converter are
diverse in production code.

show more ...


# 7f2fb806 17-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Don't use Frame::hash or hashCallStacks in unit test (#119984)

This patch checks the result of YAML parsing at the level of
MemProfRecord instead of IndexedMemProfRecord, thereby avoiding

[memprof] Don't use Frame::hash or hashCallStacks in unit test (#119984)

This patch checks the result of YAML parsing at the level of
MemProfRecord instead of IndexedMemProfRecord, thereby avoiding use of
Frame::hash and hashCallStacks. This makes sense because we
ultimately care about consumers like MemProfiler.cpp obtaining
MemProfRecord correctly; IndexedMemProfData and hash values are just
intermediaries.

Once this patch lands, we call Frame::hash and hashCallStacks only
when adding Frames or call stacks to their respective data structures.
In other words, the hash functions are pretty much business internal
to IndexedMemProfRecord.

show more ...


Revision tags: llvmorg-19.1.6
# ab07c515 13-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Don't use Frame::hash() (NFC) (#119828)

In these tests, we just want to add one instance of
IndexedMemProfRecord to MemProfData.Records and retrieve it from
MemProfReader. There is no p

[memprof] Don't use Frame::hash() (NFC) (#119828)

In these tests, we just want to add one instance of
IndexedMemProfRecord to MemProfData.Records and retrieve it from
MemProfReader. There is no particular reason to associate F1.hash()
with the IndexedMemProfRecord instance. A fake value suffices.

While I am at it, I'm switching to try_emplace so that I can move
FakeRecord.

show more ...


# 9b14ded1 12-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Use return values from addFrame and addCallStack (NFC) (#119676)

Migrating away from Frame::hash and hashCallStack further encapsulates
how the IDs are calculated.

Note that unit tests

[memprof] Use return values from addFrame and addCallStack (NFC) (#119676)

Migrating away from Frame::hash and hashCallStack further encapsulates
how the IDs are calculated.

Note that unit tests are the only places where Frame::hash and
hashCallStack are used. The code proper (i.e. llvm/lib) uses
IndexedMemProfData::{addFrame,addCallStack}; they do not directly use
Frame::hash or hashCallStack.

show more ...


# fda80a4f 12-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Use addCallStack in a unit test (NFC) (#119651)

Here IndexedMemProfRecord just needs to reference a CallStackID, so we
can use addCallStack for a real hash-based CallStackId instead of a

[memprof] Use addCallStack in a unit test (NFC) (#119651)

Here IndexedMemProfRecord just needs to reference a CallStackID, so we
can use addCallStack for a real hash-based CallStackId instead of a
fake value like 0x222.

show more ...


# 64fadf17 12-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Use IndexedMemProfData in unit tests (NFC) (#119648)

This patch uses IndexedMemProfData in unit tests even when we only
need CallStacks. This way, we get to use addCallStack. Also, the

[memprof] Use IndexedMemProfData in unit tests (NFC) (#119648)

This patch uses IndexedMemProfData in unit tests even when we only
need CallStacks. This way, we get to use addCallStack. Also, the
look is more consistent with other unit tests, where we typically do:

IndexMemProfData MemProfData;
MemProfData.addFrame(...);
MemProfData.addCallStack(...);
// Run some tests

show more ...


# 8420602b 12-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Drop testing:: in a unit test (NFC) (#119636)

Note that we already have:

using ::testing::IsEmpty;


# 9040dd46 12-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Improve the way we express Frames in YAML (#119629)

This patch does two things:

- During deserialization, we accept a function name for Frame as an
alternative to the usual GUID expr

[memprof] Improve the way we express Frames in YAML (#119629)

This patch does two things:

- During deserialization, we accept a function name for Frame as an
alternative to the usual GUID expressed as a hexadecimal number.

- During serialization, we print a GUID of Frame as a 16-digit
hexadecimal number prefixed with 0x in the usual way. (Without this
patch, we print a decimal number, which is not customary.)

The patch uses a machinery called "normalization" in YAML I/O, which
lets us serialize and deserialize into an alternative data structure.
For our use case, we have an alternative Frame data structure, which
is identical to "struct Frame" except that Function is of type
GUIDHex64 instead of GlobalValue::GUID. This alternative type
supports the two bullet points above without modifying "struct Frame"
at all.

show more ...


# 66edefae 11-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Move YAML support to MemProfYAML.h (NFC) (#119515)

The YAML support is increasing in size, so this patch moves it to a
separate file.


# 9aa5848d 11-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Drop curly braces on small for loops (NFC) (#119516)


# 9b948699 11-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Use front instead of begin in a unit test (NFC) (#119501)

"front" allows us to drop a dereference.


# 76b49312 11-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Accept a function name in YAML (#119453)

This patch does two things:

- During deserialization, we accept a function name as an alternative
to the usual GUID represented as a hexadeci

[memprof] Accept a function name in YAML (#119453)

This patch does two things:

- During deserialization, we accept a function name as an alternative
to the usual GUID represented as a hexadecimal number.

- During serialization, we print a GUID as a 16-digit hexadecimal
number prefixed with 0x in the usual way. (Without this patch, we
print a decimal number, which is not customary.)

In YAML, the MemProf profile is a vector of pairs of GUID and
MemProfRecord. This patch accepts a function name for the GUID, but
it does not accept a function name for the GUID used in Frames yet.
That will be addressed in a subsequent patch.

show more ...


# 1708519f 09-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Use std::make_unique in unit tests (NFC) (#119175)


# 6a137fbe 09-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Use namespaces in a unit test (#119144)

MemProfTest.cpp is about MemProf, so mentioning llvm::memprof
everywhere is quite verbose.


# b6dfdd2b 08-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Drop memprof:: in unit tests (NFC) (#119113)

This patch replaces memprof::Foo with Foo if we have corresponding:

using llvm::memprof::Foo;


# 6c062afc 08-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Compare Frames instead of FrameIds in a unit test (#119111)

When we call IndexedMemProfRecord::toMemProfRecord, we care about
getting the original (that is, non-indexed) MemProfRecord bac

[memprof] Compare Frames instead of FrameIds in a unit test (#119111)

When we call IndexedMemProfRecord::toMemProfRecord, we care about
getting the original (that is, non-indexed) MemProfRecord back, so we
should just verify that, not the hash values, which are
intermediaries.

There is a remote possibility of hash collisions where call stack
{F1, F2} might come back as {F1, F1} if F1.hash() == F2.hash() for
example. However, since FrameId uses BLAKE, the hash values should be
consistent across architectures. That is, if this test case works on
one architecture, it should work on others as well.

show more ...


# 8eb5baf5 07-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Use IndexedMemProfData in a unit test (NFC) (#119062)

IndexedMemProfData eliminates the need for the "using" directives.
Also, we do not need to declare maps for individual components of

[memprof] Use IndexedMemProfData in a unit test (NFC) (#119062)

IndexedMemProfData eliminates the need for the "using" directives.
Also, we do not need to declare maps for individual components of the
MemProf profile.

show more ...


# 32f7f001 07-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Use gtest matchers at more places (#119050)

These gtest matchers reduce the number of times we mention the
variables under examined.


# 00090ac0 07-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Use IndexedMemProfData in tests (NFC) (#119049)

This patch replaces FrameIdMap and CallStackIdMap with
IndexedMemProfData, which comes with recently introduced methods like
addFrame and

[memprof] Use IndexedMemProfData in tests (NFC) (#119049)

This patch replaces FrameIdMap and CallStackIdMap with
IndexedMemProfData, which comes with recently introduced methods like
addFrame and addCallStack.

show more ...


# c5e4e8f8 06-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Add IndexedMemProfData::addCallStack (#118920)

This patch adds a helper function to replace an idiom like:

CallStackId CSId = hashCallStack(CallStack)
MemProfData.CallStacks.try_em

[memprof] Add IndexedMemProfData::addCallStack (#118920)

This patch adds a helper function to replace an idiom like:

CallStackId CSId = hashCallStack(CallStack)
MemProfData.CallStacks.try_emplace(CSId, CallStack);
// Do something with CSId.

show more ...


# d88a0c73 06-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Rename Inline to IsInlineFrame in YAML (#118901)

This patch makes the YAML field name match the struct field name.


# dbd920b2 05-Dec-2024 Kazu Hirata <kazu@google.com>

Reapply [memprof] Update YAML traits for writer purposes (#118720)

For Frames, we prefer the inline notation for the brevity.

For PortableMemInfoBlock, we go through all member fields and print
out

Reapply [memprof] Update YAML traits for writer purposes (#118720)

For Frames, we prefer the inline notation for the brevity.

For PortableMemInfoBlock, we go through all member fields and print
out those that are populated.

This iteration works around the unavailability of
ScalarTraits<uintptr_t> on macOS.

show more ...


# 0772a0bd 05-Dec-2024 Florian Hahn <flo@fhahn.com>

Revert "[memprof] Update YAML traits for writer purposes (#118720)"

This reverts commit 7b8cf147addf7d3fb4630475c40153226f5fdbd0.

Breaks building on macOS
https://lab.llvm.org/buildbot/#/builde

Revert "[memprof] Update YAML traits for writer purposes (#118720)"

This reverts commit 7b8cf147addf7d3fb4630475c40153226f5fdbd0.

Breaks building on macOS
https://lab.llvm.org/buildbot/#/builders/190/builds/10737
https://lab.llvm.org/buildbot/#/builders/23/builds/5491
https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-cmake-RA-incremental/6076/

show more ...


# 50f8580e 05-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Add IndexedMemProfData::addFrame (#118724)

This patch adds a helper function to replace an idiom like:

FrameId Id = F.hash();
MemProfData.Frames.try_emplace(Id, F);
// Do someth

[memprof] Add IndexedMemProfData::addFrame (#118724)

This patch adds a helper function to replace an idiom like:

FrameId Id = F.hash();
MemProfData.Frames.try_emplace(Id, F);
// Do something with Id.

show more ...


# 7b8cf147 05-Dec-2024 Kazu Hirata <kazu@google.com>

[memprof] Update YAML traits for writer purposes (#118720)

For Frames, we prefer the inline notation for the brevity.

For PortableMemInfoBlock, we go through all member fields and print
out thos

[memprof] Update YAML traits for writer purposes (#118720)

For Frames, we prefer the inline notation for the brevity.

For PortableMemInfoBlock, we go through all member fields and print
out those that are populated.

show more ...


1234