diff options
Diffstat (limited to 'src/zen/trace/trace_cmd.h')
| -rw-r--r-- | src/zen/trace/trace_cmd.h | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/src/zen/trace/trace_cmd.h b/src/zen/trace/trace_cmd.h new file mode 100644 index 000000000..bb2759241 --- /dev/null +++ b/src/zen/trace/trace_cmd.h @@ -0,0 +1,123 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#pragma once + +#include "zen.h" + +#include <filesystem> +#include <string> + +namespace zen { + +class TraceAnalyzeSubCmd : public ZenSubCmdBase +{ +public: + TraceAnalyzeSubCmd(); + void Run(const ZenCliOptions& GlobalOptions) override; + +private: + std::filesystem::path m_TraceFilePath; + int m_LiveAllocs = 0; + int m_Churn = 0; + int m_ChurnMin = 1000; + std::string m_Symbols; + std::string m_CallstackSkip; + bool m_NoCache = false; + bool m_NoCallstackHeuristic = false; + std::filesystem::path m_HtmlReportPath; +}; + +class TraceInspectSubCmd : public ZenSubCmdBase +{ +public: + TraceInspectSubCmd(); + void Run(const ZenCliOptions& GlobalOptions) override; + +private: + std::filesystem::path m_TraceFilePath; +}; + +class TraceServeSubCmd : public ZenSubCmdBase +{ +public: + TraceServeSubCmd(); + void Run(const ZenCliOptions& GlobalOptions) override; + +private: + std::filesystem::path m_TraceFilePath; + std::string m_Symbols; + int m_Port = 0; + std::string m_Bind = "127.0.0.1"; + bool m_NoBrowser = false; +}; + +class TraceTrimSubCmd : public ZenSubCmdBase +{ +public: + TraceTrimSubCmd(); + void Run(const ZenCliOptions& GlobalOptions) override; + +private: + std::filesystem::path m_TraceFilePath; + std::filesystem::path m_OutputPath; + double m_StartSec = 0.0; + double m_EndSec = 0.0; +}; + +class TraceStartSubCmd : public ZenSubCmdBase +{ +public: + TraceStartSubCmd(); + void Run(const ZenCliOptions& GlobalOptions) override; + +private: + std::string m_HostName; + std::string m_TraceHost; + std::string m_TraceFile; +}; + +class TraceStopSubCmd : public ZenSubCmdBase +{ +public: + TraceStopSubCmd(); + void Run(const ZenCliOptions& GlobalOptions) override; + +private: + std::string m_HostName; +}; + +class TraceStatusSubCmd : public ZenSubCmdBase +{ +public: + TraceStatusSubCmd(); + void Run(const ZenCliOptions& GlobalOptions) override; + +private: + std::string m_HostName; +}; + +class TraceCommand : public ZenCmdWithSubCommands +{ +public: + static constexpr char Name[] = "trace"; + static constexpr char Description[] = "Control zen realtime tracing and work with .utrace files"; + + TraceCommand(); + ~TraceCommand(); + + cxxopts::Options& Options() override { return m_Options; } + +private: + cxxopts::Options m_Options{Name, Description}; + std::string m_SubCommand; + + TraceAnalyzeSubCmd m_AnalyzeSubCmd; + TraceInspectSubCmd m_InspectSubCmd; + TraceServeSubCmd m_ServeSubCmd; + TraceTrimSubCmd m_TrimSubCmd; + TraceStartSubCmd m_StartSubCmd; + TraceStopSubCmd m_StopSubCmd; + TraceStatusSubCmd m_StatusSubCmd; +}; + +} // namespace zen |