Skip to content

Commit

Permalink
Activate profile in python and HTTP interface (#2395)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

Activate profile in python and HTTP interface

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Signed-off-by: Jin Hai <[email protected]>
  • Loading branch information
JinHai-CN authored Dec 20, 2024
1 parent daed29a commit 178ebcb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main/infinity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ std::variant<UniquePtr<QueryContext>, QueryResult> Infinity::GetQueryContext(boo
if (std::holds_alternative<QueryResult>(result)) { \
return std::get<QueryResult>(result); \
} \
query_context_ptr = std::move(std::get<UniquePtr<QueryContext>>(result));
query_context_ptr = std::move(std::get<UniquePtr<QueryContext>>(result)); \
query_context_ptr->CreateQueryProfiler();

u64 Infinity::GetSessionId() { return session_->session_id(); }

Expand Down
4 changes: 3 additions & 1 deletion src/main/query_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,9 @@ QueryResult QueryContext::QueryStatement(const BaseStatement *base_statement) {

void QueryContext::CreateQueryProfiler() {
if (InfinityContext::instance().storage()->catalog()->GetProfile()) {
query_profiler_ = MakeShared<QueryProfiler>(true);
if(query_profiler_ == nullptr) {
query_profiler_ = MakeShared<QueryProfiler>(true);
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/query_context.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ public:
}
}

void CreateQueryProfiler();

private:
QueryResult HandleAdminStatement(const AdminStatement* admin_statement);

private:

void CreateQueryProfiler();
void RecordQueryProfiler(const StatementType &type);
void StartProfile(QueryPhase phase);
void StopProfile(QueryPhase phase);
Expand Down

0 comments on commit 178ebcb

Please sign in to comment.