MCPcopy Create free account
hub / github.com/apache/impala / InitProfile

Function InitProfile

be/src/benchmarks/runtime-profile-benchmark.cc:51–79  ·  view source on GitHub ↗

Initialise *profile to a synthetic profile stored in 'profile_pool'. The tree should have the provided depth and fanout.

Source from the content-addressed store, hash-verified

49// Initialise *profile to a synthetic profile stored in 'profile_pool'.
50// The tree should have the provided depth and fanout.
51void InitProfile(int depth, int fanout, RuntimeProfile** profile) {
52 *profile = RuntimeProfile::Create(&profile_pool, Substitute("level$0", depth));
53 // Profiles tend to mainly have regular counters.
54 const int NUM_REGULAR_COUNTERS = 20;
55 // Include a smaller number of other profile items.
56 const int NUM_OTHER_ITEMS = 5;
57 for (int i = 0; i < NUM_REGULAR_COUNTERS; ++i) {
58 (*profile)->AddCounter(Substitute("counter$0", i), TUnit::NONE);
59 }
60 RuntimeProfile::EventSequence* seq = (*profile)->AddEventSequence("timeline");
61 for (int i = 0; i < NUM_OTHER_ITEMS; ++i) {
62 (*profile)->AddInfoString(Substitute("info$0", i), Substitute("val$0", i));
63 seq->MarkEvent(Substitute("event$0", i));
64 RuntimeProfile::SummaryStatsCounter* stats =
65 (*profile)->AddSummaryStatsCounter(Substitute("stats$0", i), TUnit::BYTES);
66 stats->UpdateCounter(1);
67 stats->UpdateCounter(2);
68 stats->UpdateCounter(3);
69
70 // Do not add time series or sampling counters, those are tricky to mock because they
71 // are usually updated by a background thread.
72 }
73 if (depth == 0) return;
74 for (int i = 0; i < fanout; ++i) {
75 RuntimeProfile* child_profile;
76 InitProfile(depth - 1, fanout, &child_profile);
77 (*profile)->AddChild(child_profile, /*indent=*/ i % 2 == 0);
78 }
79}
80
81void ToThriftBenchmark(int batch_size, void* dummy) {
82 for (int i = 0; i < batch_size; ++i) {

Callers 1

mainFunction · 0.85

Calls 9

CreateClass · 0.85
SubstituteFunction · 0.85
AddCounterMethod · 0.80
AddEventSequenceMethod · 0.80
AddInfoStringMethod · 0.80
MarkEventMethod · 0.80
AddChildMethod · 0.80
UpdateCounterMethod · 0.45

Tested by

no test coverage detected