MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / peekThread

Function peekThread

test/chbench/chbench/src/chBenchmark.cc:117–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117static void peekThread(const mz::Config* pConfig, const std::atomic<RunState> *pRunState,
118 std::promise<std::vector<Histogram>> promHist, useconds_t sleepMin, useconds_t sleepMax) {
119 const mz::Config& config = *pConfig;
120 const std::atomic<RunState>& runState = *pRunState;
121 pqxx::connection c(config.materializedUrl);
122 // FIXME
123 assert(!config.hQueries.empty());
124 size_t iQuery = 0;
125 size_t size = config.hQueries.size();
126 while (runState == RunState::warmup) {
127 const auto& q = config.hQueries[iQuery];
128 mz::peekView(c, q->first, q->second.order, q->second.limit);
129 iQuery = (iQuery + 1) % size;
130 auto sleepTime = chRandom::uniformInt(sleepMin, sleepMax);
131 usleep(sleepTime);
132 }
133 std::vector<Histogram> hists;
134 hists.resize(size);
135 while (runState == RunState::run) {
136 const auto& q = config.hQueries[iQuery];
137 auto latency = mz::peekView(c, q->first, q->second.order, q->second.limit).latency;
138 hists[iQuery].increment(latency.count());
139 iQuery = (iQuery + 1) % size;
140 auto sleepTime = chRandom::uniformInt(sleepMin, sleepMax);
141 usleep(sleepTime);
142 }
143 promHist.set_value(std::move(hists));
144}
145static void materializeThread(mz::Config config, std::promise<std::vector<Histogram>> promHist,
146 int peekConns, bool materializeSources, const std::atomic<RunState> *pRunState,
147 useconds_t peekMin, useconds_t peekMax) {

Callers

nothing calls this directly

Calls 7

assertFunction · 0.85
uniformIntFunction · 0.85
resizeMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
incrementMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected