88#include " ProfileGenerator.h"
99#include " ErrorHandling.h"
1010#include " MissingFrameInferrer.h"
11+ #include " Options.h"
1112#include " PerfReader.h"
1213#include " ProfiledBinary.h"
1314#include " llvm/DebugInfo/Symbolize/SymbolizableModule.h"
1718#include < unordered_set>
1819#include < utility>
1920
20- using namespace llvm ;
21- using namespace sampleprof ;
21+ namespace llvm {
2222
2323cl::opt<std::string> OutputFilename (" output" , cl::value_desc(" output" ),
2424 cl::Required,
25- cl::desc(" Output profile file" ));
25+ cl::desc(" Output profile file" ),
26+ cl::cat(ProfGenCategory));
2627static cl::alias OutputA (" o" , cl::desc(" Alias for --output" ),
2728 cl::aliasopt(OutputFilename));
2829
2930static cl::opt<SampleProfileFormat> OutputFormat (
3031 " format" , cl::desc(" Format of output profile" ), cl::init(SPF_Ext_Binary),
31- cl::values(
32- clEnumValN (SPF_Binary, " binary" , " Binary encoding (default)" ),
33- clEnumValN(SPF_Ext_Binary, " extbinary" , " Extensible binary encoding" ),
34- clEnumValN(SPF_Text, " text" , " Text encoding" ),
35- clEnumValN(SPF_GCC, " gcc" ,
36- " GCC encoding (only meaningful for -sample)" )));
32+ cl::values(clEnumValN(SPF_Binary, " binary" , " Binary encoding (default)" ),
33+ clEnumValN(SPF_Ext_Binary, " extbinary" ,
34+ " Extensible binary encoding" ),
35+ clEnumValN(SPF_Text, " text" , " Text encoding" ),
36+ clEnumValN(SPF_GCC, " gcc" ,
37+ " GCC encoding (only meaningful for -sample)" )),
38+ cl::cat(ProfGenCategory));
3739
3840static cl::opt<bool > UseMD5 (
3941 " use-md5" , cl::Hidden,
@@ -59,55 +61,57 @@ static cl::opt<int32_t, true> RecursionCompression(
5961static cl::opt<bool >
6062 TrimColdProfile (" trim-cold-profile" ,
6163 cl::desc (" If the total count of the profile is smaller "
62- " than threshold, it will be trimmed." ));
64+ " than threshold, it will be trimmed." ),
65+ cl::cat(ProfGenCategory));
6366
6467static cl::opt<bool > CSProfMergeColdContext (
6568 " csprof-merge-cold-context" , cl::init(true ),
6669 cl::desc(" If the total count of context profile is smaller than "
6770 " the threshold, it will be merged into context-less base "
68- " profile." ));
71+ " profile." ),
72+ cl::cat(ProfGenCategory));
6973
7074static cl::opt<uint32_t > CSProfMaxColdContextDepth (
7175 " csprof-max-cold-context-depth" , cl::init(1 ),
7276 cl::desc(" Keep the last K contexts while merging cold profile. 1 means the "
73- " context-less base profile" ));
77+ " context-less base profile" ),
78+ cl::cat(ProfGenCategory));
7479
7580static cl::opt<int , true > CSProfMaxContextDepth (
7681 " csprof-max-context-depth" ,
7782 cl::desc (" Keep the last K contexts while merging profile. -1 means no "
7883 " depth limit." ),
79- cl::location(llvm::sampleprof::CSProfileGenerator::MaxContextDepth));
84+ cl::location(llvm::sampleprof::CSProfileGenerator::MaxContextDepth),
85+ cl::cat(ProfGenCategory));
8086
8187static cl::opt<double > ProfileDensityThreshold (
82- " profile-density-threshold" , llvm:: cl::init(50 ),
83- llvm:: cl::desc(" If the profile density is below the given threshold, it "
84- " will be suggested to increase the sampling rate." ),
85- llvm:: cl::Optional );
86- static cl::opt<bool > ShowDensity (" show-density" , llvm:: cl::init(false ),
87- llvm:: cl::desc(" show profile density details" ),
88- llvm:: cl::Optional );
88+ " profile-density-threshold" , cl::init(50 ),
89+ cl::desc(" If the profile density is below the given threshold, it "
90+ " will be suggested to increase the sampling rate." ),
91+ cl::Optional, cl::cat(ProfGenCategory) );
92+ static cl::opt<bool > ShowDensity (" show-density" , cl::init(false ),
93+ cl::desc(" show profile density details" ),
94+ cl::Optional, cl::cat(ProfGenCategory) );
8995static cl::opt<int > ProfileDensityCutOffHot (
90- " profile-density-cutoff-hot" , llvm::cl::init(990000 ),
91- llvm::cl::desc(" Total samples cutoff for functions used to calculate "
92- " profile density." ));
96+ " profile-density-cutoff-hot" , cl::init(990000 ),
97+ cl::desc(" Total samples cutoff for functions used to calculate "
98+ " profile density." ),
99+ cl::cat(ProfGenCategory));
93100
94101static cl::opt<bool > UpdateTotalSamples (
95- " update-total-samples" , llvm::cl::init(false ),
96- llvm::cl::desc(
97- " Update total samples by accumulating all its body samples." ),
98- llvm::cl::Optional);
102+ " update-total-samples" , cl::init(false ),
103+ cl::desc(" Update total samples by accumulating all its body samples." ),
104+ cl::Optional, cl::cat(ProfGenCategory));
99105
100106static cl::opt<bool > GenCSNestedProfile (
101107 " gen-cs-nested-profile" , cl::Hidden, cl::init(true ),
102108 cl::desc(" Generate nested function profiles for CSSPGO" ));
103109
104110cl::opt<bool > InferMissingFrames (
105- " infer-missing-frames" , llvm:: cl::init(true ),
106- llvm:: cl::desc(
111+ " infer-missing-frames" , cl::init(true ),
112+ cl::desc(
107113 " Infer missing call frames due to compiler tail call elimination." ),
108- llvm::cl::Optional);
109-
110- namespace llvm {
114+ cl::Optional, cl::cat(ProfGenCategory));
111115
112116namespace sampleprof {
113117
0 commit comments