-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Expose planningCpu time in QueryStats #3269
Conversation
presto-main/src/main/java/io/prestosql/dispatcher/FailedDispatchQuery.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/execution/QueryStateMachine.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/execution/QueryStateMachine.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/execution/QueryStateTimer.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/execution/QueryStateTimer.java
Outdated
Show resolved
Hide resolved
presto-main/src/main/java/io/prestosql/execution/QueryStateTimer.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks fine. Please fix tests
Ops, need to fix the test |
@@ -36,6 +42,9 @@ | |||
private final AtomicReference<Long> beginResourceWaitingNanos = new AtomicReference<>(); | |||
private final AtomicReference<Long> beginDispatchingNanos = new AtomicReference<>(); | |||
private final AtomicReference<Long> beginPlanningNanos = new AtomicReference<>(); | |||
private final AtomicReference<Long> beginPlanningCpuNanos = new AtomicReference<>(); | |||
private final AtomicReference<Long> beginPlanningThreadId = new AtomicReference<>(); | |||
private final AtomicReference<Long> beginStartingThreadId = new AtomicReference<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need to store starting thread id
. Just beginPlanningThreadId
is enough
planningTime.compareAndSet(null, nanosSince(beginPlanningNanos, now)); | ||
planningCpuTime.compareAndSet(null, nanosSince(beginPlanningCpuNanos, cpuNow)); | ||
beginStartingThreadId.compareAndSet(null, threadId); | ||
if (!beginPlanningThreadId.get().equals(beginStartingThreadId.get())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use checkState
as this should never happen
@Terry93 could you rebase? |
@Terry93 will you have time to complete this PR? |
@sopel39 Sorry about that, I completely forgot it. I will finish this one, thanks! |
👋 @puchengy - this PR is inactive and doesn't seem to be under development. If you'd like to continue work on this at any point in the future, feel free to re-open. |
This is for #2579
I have a few questions, hope can have some ideas on what should be improved in this PR:
Is this the right way to measure CPU? I borrowed it from other places in the repo. And the underlying assumption is the planning is performed by a single thread.
Should we update this QueryCompleteEvent API to incorporate this as well? However
planning time
is not in the API as well.Do you think we should have a standalone unit test for this change (my answer is that it is not needed)?