diff options
Diffstat (limited to 'llvm/tools/llvm-xray/xray-converter.cpp')
-rw-r--r-- | llvm/tools/llvm-xray/xray-converter.cpp | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/llvm/tools/llvm-xray/xray-converter.cpp b/llvm/tools/llvm-xray/xray-converter.cpp index 34832eb..0f45fef 100644 --- a/llvm/tools/llvm-xray/xray-converter.cpp +++ b/llvm/tools/llvm-xray/xray-converter.cpp @@ -176,13 +176,14 @@ struct StackIdData { // unique ID. SmallVector<TrieNode<StackIdData> *, 4> siblings; }; +} // namespace using StackTrieNode = TrieNode<StackIdData>; // A helper function to find the sibling nodes for an encountered function in a // thread of execution. Relies on the invariant that each time a new node is // traversed in a thread, sibling bidirectional pointers are maintained. -SmallVector<StackTrieNode *, 4> +static SmallVector<StackTrieNode *, 4> findSiblings(StackTrieNode *parent, int32_t FnId, uint32_t TId, const DenseMap<uint32_t, SmallVector<StackTrieNode *, 4>> &StackRootsByThreadId) { @@ -213,7 +214,7 @@ findSiblings(StackTrieNode *parent, int32_t FnId, uint32_t TId, // StackTrie representing the function call stack. If no node exists, creates // the node. Assigns unique IDs to stacks newly encountered among all threads // and keeps sibling links up to when creating new nodes. -StackTrieNode *findOrCreateStackNode( +static StackTrieNode *findOrCreateStackNode( StackTrieNode *Parent, int32_t FuncId, uint32_t TId, DenseMap<uint32_t, SmallVector<StackTrieNode *, 4>> &StackRootsByThreadId, DenseMap<unsigned, StackTrieNode *> &StacksByStackId, unsigned *id_counter, @@ -244,12 +245,13 @@ StackTrieNode *findOrCreateStackNode( return CurrentStack; } -void writeTraceViewerRecord(uint16_t Version, raw_ostream &OS, int32_t FuncId, - uint32_t TId, uint32_t PId, bool Symbolize, - const FuncIdConversionHelper &FuncIdHelper, - double EventTimestampUs, - const StackTrieNode &StackCursor, - StringRef FunctionPhenotype) { +static void writeTraceViewerRecord(uint16_t Version, raw_ostream &OS, + int32_t FuncId, uint32_t TId, uint32_t PId, + bool Symbolize, + const FuncIdConversionHelper &FuncIdHelper, + double EventTimestampUs, + const StackTrieNode &StackCursor, + StringRef FunctionPhenotype) { OS << " "; if (Version >= 3) { OS << llvm::formatv( @@ -269,8 +271,6 @@ void writeTraceViewerRecord(uint16_t Version, raw_ostream &OS, int32_t FuncId, } } -} // namespace - void TraceConverter::exportAsChromeTraceEventFormat(const Trace &Records, raw_ostream &OS) { const auto &FH = Records.getFileHeader(); @@ -364,9 +364,6 @@ void TraceConverter::exportAsChromeTraceEventFormat(const Trace &Records, OS << "}\n"; // Close the JSON entry. } -namespace llvm { -namespace xray { - static CommandRegistration Unused(&Convert, []() -> Error { // FIXME: Support conversion to BINARY when upgrading XRay trace versions. InstrumentationMap Map; @@ -386,9 +383,9 @@ static CommandRegistration Unused(&Convert, []() -> Error { if (Demangle.getPosition() < NoDemangle.getPosition()) SymbolizerOpts.Demangle = false; symbolize::LLVMSymbolizer Symbolizer(SymbolizerOpts); - llvm::xray::FuncIdConversionHelper FuncIdHelper(ConvertInstrMap, Symbolizer, - FunctionAddresses); - llvm::xray::TraceConverter TC(FuncIdHelper, ConvertSymbolize); + FuncIdConversionHelper FuncIdHelper(ConvertInstrMap, Symbolizer, + FunctionAddresses); + TraceConverter TC(FuncIdHelper, ConvertSymbolize); std::error_code EC; raw_fd_ostream OS(ConvertOutput, EC, ConvertOutputFormat == ConvertFormats::BINARY @@ -420,6 +417,3 @@ static CommandRegistration Unused(&Convert, []() -> Error { } return Error::success(); }); - -} // namespace xray -} // namespace llvm |