|
|
|
@ -186,9 +186,9 @@ TEST(AnalyzeProfileProtoTest, PrintStatistics) { |
|
|
|
|
R"(Message google::protobuf::compiler::tools::AnalyzeThis |
|
|
|
|
int32 id: RARELY_USED(100) |
|
|
|
|
string optional_string: RARELY_USED(100) |
|
|
|
|
string[] repeated_string: LIKELY_PRESENT RARELY_USED(100) |
|
|
|
|
AnalyzeChild optional_child: LIKELY_PRESENT RARELY_USED(1) LAZY |
|
|
|
|
AnalyzeChild[] repeated_child: LIKELY_PRESENT RARELY_USED(100) |
|
|
|
|
string[] repeated_string: LIKELY_PRESENT(100.00%) RARELY_USED(100) |
|
|
|
|
AnalyzeChild optional_child: LIKELY_PRESENT(100.00%) RARELY_USED(1) LAZY |
|
|
|
|
AnalyzeChild[] repeated_child: LIKELY_PRESENT(100.00%) RARELY_USED(100) |
|
|
|
|
Nested nested: RARELY_USED(100) |
|
|
|
|
======== |
|
|
|
|
singular_lazy_num=1 |
|
|
|
@ -209,6 +209,53 @@ repeated_lazy_pcount/repeated_total_pcount=0 |
|
|
|
|
)"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TEST(AnalyzeProfileProtoTest, PrintStatisticsAll) { |
|
|
|
|
AccessInfo info = ParseTextOrDie(R"pb( |
|
|
|
|
language: "cpp" |
|
|
|
|
message { |
|
|
|
|
name: "google::protobuf::compiler::tools::AnalyzeThis" |
|
|
|
|
count: 100 |
|
|
|
|
field { name: "id" getters_count: 1 configs_count: 100 } |
|
|
|
|
field { name: "optional_string" getters_count: 1 configs_count: 100 } |
|
|
|
|
field { name: "optional_child" getters_count: 100 configs_count: 1 } |
|
|
|
|
field { name: "repeated_string" getters_count: 100 configs_count: 100 } |
|
|
|
|
field { name: "repeated_child" getters_count: 100 configs_count: 100 } |
|
|
|
|
field { name: "nested" getters_count: 1 configs_count: 100 } |
|
|
|
|
} |
|
|
|
|
)pb"); |
|
|
|
|
AnalyzeProfileProtoOptions options; |
|
|
|
|
options.print_unused_threshold = false; |
|
|
|
|
options.print_optimized = false; |
|
|
|
|
options.print_analysis = true; |
|
|
|
|
options.print_analysis_all = true; |
|
|
|
|
options.pool = DescriptorPool::generated_pool(); |
|
|
|
|
EXPECT_STREQ(AnalyzeToText(info, options).c_str(), |
|
|
|
|
R"(Message google::protobuf::compiler::tools::AnalyzeThis |
|
|
|
|
int32 id: DEFAULT_PRESENT(1.00%) RARELY_USED(100) |
|
|
|
|
string optional_string: DEFAULT_PRESENT(1.00%) RARELY_USED(100) |
|
|
|
|
string[] repeated_string: LIKELY_PRESENT(100.00%) RARELY_USED(100) |
|
|
|
|
AnalyzeChild optional_child: LIKELY_PRESENT(100.00%) RARELY_USED(1) LAZY |
|
|
|
|
AnalyzeChild[] repeated_child: LIKELY_PRESENT(100.00%) RARELY_USED(100) |
|
|
|
|
Nested nested: DEFAULT_PRESENT(1.00%) RARELY_USED(100) |
|
|
|
|
======== |
|
|
|
|
singular_lazy_num=1 |
|
|
|
|
singular_lazy_0usage_num=0 |
|
|
|
|
repeated_lazy_num=0 |
|
|
|
|
singular_total_pcount=101 |
|
|
|
|
repeated_total_pcount=100 |
|
|
|
|
singular_lazy_pcount=100 |
|
|
|
|
singular_lazy_0usage_pcount=0 |
|
|
|
|
repeated_lazy_pcount=0 |
|
|
|
|
max_pcount=100 |
|
|
|
|
max_ucount=100 |
|
|
|
|
repeated_lazy_num/singular_lazy_num=0 |
|
|
|
|
repeated_lazy_pcount/singular_lazy_pcount=0 |
|
|
|
|
singular_lazy_pcount/singular_total_pcount=0.990099 |
|
|
|
|
singular_lazy_0usage_pcount/singular_total_pcount=0 |
|
|
|
|
repeated_lazy_pcount/repeated_total_pcount=0 |
|
|
|
|
)"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
} // namespace tools
|
|
|
|
|
} // namespace compiler
|
|
|
|
|