8000 fix profile output for nodes without calls to getSome by jsteemann · Pull Request #6397 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

fix profile output for nodes without calls to getSome #6397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 10, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix profile output for nodes without calls to getSome
  • Loading branch information
jsteemann committed Sep 5, 2018
commit 7cf9517f802387df12bad45aaeb9853e79c231e7
11 changes: 8 additions & 3 deletions arangod/Aql/ExecutionBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,16 @@ ExecutionBlock::ExecutionBlock(ExecutionEngine* engine, ExecutionNode const* ep)
_pos(0),
_done(false),
_profile(engine->getQuery()->queryOptions().profile),
_getSomeBegin(0),
_getSomeBegin(0.0),
_upstreamState(ExecutionState::HASMORE),
_skipped(0),
_collector(&engine->_itemBlockManager) {
TRI_ASSERT(_trx != nullptr);

// already insert ourselves into the statistics results
if (_profile >= PROFILE_LEVEL_BLOCKS) {
_engine->_stats.nodes.emplace(ep->id(), ExecutionStats::Node());
}
}

ExecutionBlock::~ExecutionBlock() {
Expand Down Expand Up @@ -185,7 +190,7 @@ std::pair<ExecutionState, Result> ExecutionBlock::shutdown(int errorCode) {
// Trace the start of a getSome call
void ExecutionBlock::traceGetSomeBegin(size_t atMost) {
if (_profile >= PROFILE_LEVEL_BLOCKS) {
if (_getSomeBegin == 0) {
if (_getSomeBegin <= 0.0) {
_getSomeBegin = TRI_microtime();
}
if (_profile >= PROFILE_LEVEL_TRACE_1) {
Expand All @@ -208,7 +213,7 @@ void ExecutionBlock::traceGetSomeEnd(AqlItemBlock const* result, ExecutionState
stats.items = result != nullptr ? result->size() : 0;
if (state != ExecutionState::WAITING) {
stats.runtime = TRI_microtime() - _getSomeBegin;
_getSomeBegin = 0;
_getSomeBegin = 0.0;
}

auto it = _engine->_stats.nodes.find(en->id());
Expand Down
2 changes: 1 addition & 1 deletion arangod/Aql/ExecutionStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct ExecutionStats {
struct Node {
size_t calls = 0;
size_t items = 0;
double runtime = 0;
double runtime = 0.0;
ExecutionStats::Node& operator+=(ExecutionStats::Node const& other) {
calls += other.calls;
items += other.items;
Expand Down
1 change: 1 addition & 0 deletions js/common/modules/@arangodb/aql/explainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,7 @@ function processQuery (query, explain) {

var printNode = function (node) {
preHandle(node);
node.runtime = Math.abs(node.runtime);
var line = ' ' +
pad(1 + maxIdLen - String(node.id).length) + variable(node.id) + ' ' +
keyword(node.type) + pad(1 + maxTypeLen - String(node.type).length) + ' ';
Expand Down
0