aboutsummaryrefslogtreecommitdiff
path: root/src/zen/trace/callstack_formatter.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/zen/trace/callstack_formatter.h')
-rw-r--r--src/zen/trace/callstack_formatter.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/zen/trace/callstack_formatter.h b/src/zen/trace/callstack_formatter.h
new file mode 100644
index 000000000..067985f25
--- /dev/null
+++ b/src/zen/trace/callstack_formatter.h
@@ -0,0 +1,55 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include "symbol_resolver.h"
+#include "trace_model.h"
+
+#include <string>
+#include <vector>
+
+ZEN_THIRD_PARTY_INCLUDES_START
+#include <EASTL/hash_map.h>
+#include <EASTL/vector.h>
+ZEN_THIRD_PARTY_INCLUDES_END
+
+namespace zen::trace_detail {
+
+struct CallstackFilterOptions
+{
+ bool EnableHeuristic = true;
+ std::vector<std::string> SkipPatterns;
+};
+
+struct FilteredCallstackFrame
+{
+ size_t OriginalIndex = 0;
+ const ResolvedFrame* Frame = nullptr;
+ std::string Display;
+};
+
+struct FilteredCallstackView
+{
+ eastl::vector<FilteredCallstackFrame> Frames;
+ uint32_t HiddenPrefixCount = 0;
+ bool IncludedThirdPartyBoundary = false;
+};
+
+class CallstackFormatter
+{
+public:
+ CallstackFormatter(const TraceModel& InModel, const SymbolResolver* InSymbols);
+
+ const eastl::hash_map<uint64_t, std::string>& GetResolvedCache() const { return m_Cache; }
+
+ const CallstackEntry* FindCallstackEntry(uint32_t CallstackId) const;
+ const std::string& Describe(const ResolvedFrame& Frame);
+ FilteredCallstackView BuildView(const CallstackEntry& Entry, const CallstackFilterOptions& Options);
+
+private:
+ const TraceModel& m_Model;
+ const SymbolResolver* m_Symbols = nullptr;
+ eastl::hash_map<uint64_t, std::string> m_Cache;
+};
+
+} // namespace zen::trace_detail