diff options
| author | Stefan Boberg <[email protected]> | 2026-04-23 18:16:57 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2026-04-23 18:16:57 +0200 |
| commit | 0232b991cd7d8e3a2114ea30e4591dd3e7b65c36 (patch) | |
| tree | 94730e7594fd09ae1fa820391ce311f6daf13905 /src/zen/trace/callstack_formatter.h | |
| parent | Fix forward declaration order for s_GotSigWinch and SigWinchHandler (diff) | |
| parent | trace: declare Region event name fields as AnsiString (#1012) (diff) | |
| download | archived-zen-sb/zen-help.tar.xz archived-zen-sb/zen-help.zip | |
Merge branch 'main' into sb/zen-helpsb/zen-help
- Combine HelpCommand (this branch) with HistoryCommand (main) in zen CLI dispatcher
- Keep filter-aware TuiPickOne rewrite; adopt main's ASCII arrow glyphs in doc comment
Diffstat (limited to 'src/zen/trace/callstack_formatter.h')
| -rw-r--r-- | src/zen/trace/callstack_formatter.h | 55 |
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 |