mirror of https://gitee.com/bigwinds/arangodb
fixed results for query profiling
This commit is contained in:
parent
34eed0662f
commit
9791e467d4
|
@ -92,7 +92,7 @@ static_assert(sizeof(StateNames) / sizeof(std::string) == static_cast<size_t>(Ex
|
||||||
|
|
||||||
Profile::Profile (Query* query)
|
Profile::Profile (Query* query)
|
||||||
: query(query),
|
: query(query),
|
||||||
results(static_cast<size_t>(INVALID_STATE)),
|
results(),
|
||||||
stamp(TRI_microtime()),
|
stamp(TRI_microtime()),
|
||||||
tracked(false) {
|
tracked(false) {
|
||||||
|
|
||||||
|
@ -127,15 +127,15 @@ Profile::~Profile () {
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief enter a state
|
/// @brief sets a state to done
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void Profile::enter (ExecutionState state) {
|
void Profile::setDone (ExecutionState state) {
|
||||||
double const now = TRI_microtime();
|
double const now = TRI_microtime();
|
||||||
|
|
||||||
if (state != ExecutionState::INVALID_STATE) {
|
if (state != ExecutionState::INVALID_STATE) {
|
||||||
// record duration of state
|
// record duration of state
|
||||||
results.emplace_back(std::make_pair(state, now - stamp));
|
results.emplace_back(state, now - stamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set timestamp
|
// set timestamp
|
||||||
|
@ -1395,20 +1395,10 @@ std::vector<std::string> Query::getRulesFromOptions () const {
|
||||||
|
|
||||||
void Query::enterState (ExecutionState state) {
|
void Query::enterState (ExecutionState state) {
|
||||||
if (_profile != nullptr) {
|
if (_profile != nullptr) {
|
||||||
_profile->enter(_state);
|
// record timing for previous state
|
||||||
|
_profile->setDone(_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Just for debugging:
|
|
||||||
std::cout << "enterState: " << state;
|
|
||||||
if (_queryString != nullptr) {
|
|
||||||
std::cout << _queryString << std::endl;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
std::cout << "no querystring" << std::endl;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// and adjust the state
|
// and adjust the state
|
||||||
_state = state;
|
_state = state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace triagens {
|
||||||
|
|
||||||
~Profile ();
|
~Profile ();
|
||||||
|
|
||||||
void enter (ExecutionState);
|
void setDone (ExecutionState);
|
||||||
|
|
||||||
TRI_json_t* toJson (TRI_memory_zone_t*);
|
TRI_json_t* toJson (TRI_memory_zone_t*);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue